Guest User

Untitled

a guest
Jul 21st, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. interface A {
  2. a: string
  3. b: string
  4. }
  5.  
  6. interface B {
  7. a: string
  8. b: string
  9. c: string
  10. }
  11.  
  12. function foo(fn: (a: A) => void, a: A) {
  13. fn(a)
  14. }
  15.  
  16. function bar(arg: B): void {
  17. console.log(arg.c)
  18. }
  19.  
  20. foo(bar, {a: 'a', b: 'b'}) // This works, unfortunately
  21.  
  22. function baz(arg: string) { }
  23.  
  24. foo(baz, {a: 'a', b: 'b'}) // This fails correctly
Add Comment
Please, Sign In to add comment