File: lastPropertyInLiteralWins.symbols

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (44 lines) | stat: -rw-r--r-- 1,894 bytes parent folder | download | duplicates (5)
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))

});