Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- interface A {
- a: string
- b: string
- }
- interface B {
- a: string
- b: string
- c: string
- }
- function foo(fn: (a: A) => void, a: A) {
- fn(a)
- }
- function bar(arg: B): void {
- console.log(arg.c)
- }
- foo(bar, {a: 'a', b: 'b'}) // This works, unfortunately
- function baz(arg: string) { }
- foo(baz, {a: 'a', b: 'b'}) // This fails correctly
Add Comment
Please, Sign In to add comment