1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
=== tests/cases/compiler/lastPropertyInLiteralWins.ts ===
interface Thing {
>Thing : Symbol(Thing, Decl(lastPropertyInLiteralWins.ts, 0, 0))
thunk: (str: string) => void;
>thunk : Symbol(Thing.thunk, Decl(lastPropertyInLiteralWins.ts, 0, 17))
>str : Symbol(str, Decl(lastPropertyInLiteralWins.ts, 1, 12))
}
function test(thing: Thing) {
>test : Symbol(test, Decl(lastPropertyInLiteralWins.ts, 2, 1))
>thing : Symbol(thing, Decl(lastPropertyInLiteralWins.ts, 3, 14))
>Thing : Symbol(Thing, Decl(lastPropertyInLiteralWins.ts, 0, 0))
thing.thunk("str");
>thing.thunk : Symbol(Thing.thunk, Decl(lastPropertyInLiteralWins.ts, 0, 17))
>thing : Symbol(thing, Decl(lastPropertyInLiteralWins.ts, 3, 14))
>thunk : Symbol(Thing.thunk, Decl(lastPropertyInLiteralWins.ts, 0, 17))
}
test({ // Should error, as last one wins, and is wrong type
>test : Symbol(test, Decl(lastPropertyInLiteralWins.ts, 2, 1))
thunk: (str: string) => {},
>thunk : Symbol(thunk, Decl(lastPropertyInLiteralWins.ts, 6, 6), Decl(lastPropertyInLiteralWins.ts, 7, 31))
>str : Symbol(str, Decl(lastPropertyInLiteralWins.ts, 7, 12))
thunk: (num: number) => {}
>thunk : Symbol(thunk, Decl(lastPropertyInLiteralWins.ts, 6, 6), Decl(lastPropertyInLiteralWins.ts, 7, 31))
>num : Symbol(num, Decl(lastPropertyInLiteralWins.ts, 8, 12))
});
test({ // Should be OK. Last 'thunk' is of correct type
>test : Symbol(test, Decl(lastPropertyInLiteralWins.ts, 2, 1))
thunk: (num: number) => {},
>thunk : Symbol(thunk, Decl(lastPropertyInLiteralWins.ts, 11, 6), Decl(lastPropertyInLiteralWins.ts, 12, 31))
>num : Symbol(num, Decl(lastPropertyInLiteralWins.ts, 12, 12))
thunk: (str: string) => {}
>thunk : Symbol(thunk, Decl(lastPropertyInLiteralWins.ts, 11, 6), Decl(lastPropertyInLiteralWins.ts, 12, 31))
>str : Symbol(str, Decl(lastPropertyInLiteralWins.ts, 13, 12))
});
|