File: numericIndexerConstrainsPropertyDeclarations2.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 (121 lines) | stat: -rw-r--r-- 5,006 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
=== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts ===
// String indexer providing a constraint of a user defined type

class A {
>A : Symbol(A, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 0, 0))

    foo(): string { return ''; }
>foo : Symbol(A.foo, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 2, 9))
}

class B extends A {
>B : Symbol(B, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 4, 1))
>A : Symbol(A, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 0, 0))

    bar(): string { return ''; }
>bar : Symbol(B.bar, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 6, 19))
}

class Foo {
>Foo : Symbol(Foo, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 8, 1))

    [x: number]: A;
>x : Symbol(x, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 11, 5))
>A : Symbol(A, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 0, 0))

    1.0: A; // ok
>1.0 : Symbol(Foo[1.0], Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 11, 19))
>A : Symbol(A, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 0, 0))

    2.0: B; // ok
>2.0 : Symbol(Foo[2.0], Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 12, 11))
>B : Symbol(B, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 4, 1))

    "2.5": B // ok
>"2.5" : Symbol(Foo["2.5"], Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 13, 11))
>B : Symbol(B, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 4, 1))

    3.0: number; // error
>3.0 : Symbol(Foo[3.0], Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 14, 12))

    "4.0": string; // error
>"4.0" : Symbol(Foo["4.0"], Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 15, 16))
}

interface Foo2 {
>Foo2 : Symbol(Foo2, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 17, 1))

    [x: number]: A;
>x : Symbol(x, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 20, 5))
>A : Symbol(A, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 0, 0))

    1.0: A; // ok
>1.0 : Symbol(Foo2[1.0], Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 20, 19))
>A : Symbol(A, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 0, 0))

    2.0: B; // ok
>2.0 : Symbol(Foo2[2.0], Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 21, 11))
>B : Symbol(B, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 4, 1))

    "2.5": B // ok
>"2.5" : Symbol(Foo2["2.5"], Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 22, 11))
>B : Symbol(B, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 4, 1))

    3.0: number; // error
>3.0 : Symbol(Foo2[3.0], Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 23, 12))

    "4.0": string; // error
>"4.0" : Symbol(Foo2["4.0"], Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 24, 16))
}

var a: {
>a : Symbol(a, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 28, 3))

    [x: number]: A;
>x : Symbol(x, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 29, 5))
>A : Symbol(A, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 0, 0))

    1.0: A; // ok
>1.0 : Symbol(1.0, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 29, 19))
>A : Symbol(A, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 0, 0))

    2.0: B; // ok
>2.0 : Symbol(2.0, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 30, 11))
>B : Symbol(B, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 4, 1))

    "2.5": B // ok
>"2.5" : Symbol("2.5", Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 31, 11))
>B : Symbol(B, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 4, 1))

    3.0: number; // error
>3.0 : Symbol(3.0, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 32, 12))

    "4.0": string; // error
>"4.0" : Symbol("4.0", Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 33, 16))

};

// error
var b: { [x: number]: A } = {
>b : Symbol(b, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 38, 3))
>x : Symbol(x, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 38, 10))
>A : Symbol(A, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 0, 0))

    1.0: new A(), 
>1.0 : Symbol(1.0, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 38, 29))
>A : Symbol(A, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 0, 0))

    2.0: new B(), 
>2.0 : Symbol(2.0, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 39, 17))
>B : Symbol(B, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 4, 1))

    "2.5": new B(),
>"2.5" : Symbol("2.5", Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 40, 17))
>B : Symbol(B, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 4, 1))

    3.0: 1,
>3.0 : Symbol(3.0, Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 41, 19))

    "4.0": ''
>"4.0" : Symbol("4.0", Decl(numericIndexerConstrainsPropertyDeclarations2.ts, 42, 11))
}