File: stringIndexerConstrainsPropertyDeclarations2.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 (99 lines) | stat: -rw-r--r-- 3,866 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
=== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts ===
// String indexer providing a constraint of a user defined type

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

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

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

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

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

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

    a: A; // ok
>a : Symbol(Foo.a, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 11, 19))
>A : Symbol(A, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 0, 0))

    b: B; // ok
>b : Symbol(Foo.b, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 12, 9))
>B : Symbol(B, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 4, 1))

    c: number; // error
>c : Symbol(Foo.c, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 13, 9))

    d: string; // error
>d : Symbol(Foo.d, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 14, 14))
}

interface Foo2 {
>Foo2 : Symbol(Foo2, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 16, 1))

    [x: string]: A;
>x : Symbol(x, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 19, 5))
>A : Symbol(A, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 0, 0))

    a: A; // ok
>a : Symbol(Foo2.a, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 19, 19))
>A : Symbol(A, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 0, 0))

    b: B; // ok
>b : Symbol(Foo2.b, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 20, 9))
>B : Symbol(B, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 4, 1))

    c: number; // error
>c : Symbol(Foo2.c, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 21, 9))

    d: string; // error
>d : Symbol(Foo2.d, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 22, 14))
}

var a: {
>a : Symbol(a, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 26, 3))

    [x: string]: A;
>x : Symbol(x, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 27, 5))
>A : Symbol(A, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 0, 0))

    a: A; // ok
>a : Symbol(a, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 27, 19))
>A : Symbol(A, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 0, 0))

    b: B; // ok
>b : Symbol(b, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 28, 9))
>B : Symbol(B, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 4, 1))

    c: number; // error
>c : Symbol(c, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 29, 9))

    d: string; // error
>d : Symbol(d, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 30, 14))

};

// error
var b: { [x: string]: A } = {
>b : Symbol(b, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 35, 3))
>x : Symbol(x, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 35, 10))
>A : Symbol(A, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 0, 0))

    a: A,
>a : Symbol(a, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 35, 29))
>A : Symbol(A, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 0, 0))

    b: B
>b : Symbol(b, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 36, 9))
>B : Symbol(B, Decl(stringIndexerConstrainsPropertyDeclarations2.ts, 4, 1))
}