TypeScript/tests/cases/compiler/lastPropertyInLiteralWins.ts
2014-07-12 17:30:19 -07:00

16 lines
377 B
TypeScript

interface Thing {
thunk: (str: string) => void;
}
function test(thing: Thing) {
thing.thunk("str");
}
test({ // Should error, as last one wins, and is wrong type
thunk: (str: string) => {},
thunk: (num: number) => {}
});
test({ // Should be OK. Last 'thunk' is of correct type
thunk: (num: number) => {},
thunk: (str: string) => {}
});