|
| 1 | +=== tests/cases/compiler/forwardRefInTypeDeclaration.ts === |
| 2 | +// forward ref ignored in a typeof |
| 3 | +declare let s: typeof s1; |
| 4 | +>s : Symbol(s, Decl(forwardRefInTypeDeclaration.ts, 1, 11)) |
| 5 | +>s1 : Symbol(s1, Decl(forwardRefInTypeDeclaration.ts, 2, 5)) |
| 6 | + |
| 7 | +const s1 = "x"; |
| 8 | +>s1 : Symbol(s1, Decl(forwardRefInTypeDeclaration.ts, 2, 5)) |
| 9 | + |
| 10 | +// ignored anywhere in an interface (#35947) |
| 11 | +interface Foo2 { [s2]: number; } |
| 12 | +>Foo2 : Symbol(Foo2, Decl(forwardRefInTypeDeclaration.ts, 2, 15)) |
| 13 | +>[s2] : Symbol(Foo2[s2], Decl(forwardRefInTypeDeclaration.ts, 5, 16)) |
| 14 | +>s2 : Symbol(s2, Decl(forwardRefInTypeDeclaration.ts, 6, 5)) |
| 15 | + |
| 16 | +const s2 = "x"; |
| 17 | +>s2 : Symbol(s2, Decl(forwardRefInTypeDeclaration.ts, 6, 5)) |
| 18 | + |
| 19 | +// or in a type definition |
| 20 | +type Foo3 = { [s3]: number; } |
| 21 | +>Foo3 : Symbol(Foo3, Decl(forwardRefInTypeDeclaration.ts, 6, 15)) |
| 22 | +>[s3] : Symbol([s3], Decl(forwardRefInTypeDeclaration.ts, 9, 13)) |
| 23 | +>s3 : Symbol(s3, Decl(forwardRefInTypeDeclaration.ts, 10, 5)) |
| 24 | + |
| 25 | +const s3 = "x"; |
| 26 | +>s3 : Symbol(s3, Decl(forwardRefInTypeDeclaration.ts, 10, 5)) |
| 27 | + |
| 28 | +// or in a type literal |
| 29 | +declare const foo4: { [s4]: number; } |
| 30 | +>foo4 : Symbol(foo4, Decl(forwardRefInTypeDeclaration.ts, 13, 13)) |
| 31 | +>[s4] : Symbol([s4], Decl(forwardRefInTypeDeclaration.ts, 13, 21)) |
| 32 | +>s4 : Symbol(s4, Decl(forwardRefInTypeDeclaration.ts, 14, 5)) |
| 33 | + |
| 34 | +const s4 = "x"; |
| 35 | +>s4 : Symbol(s4, Decl(forwardRefInTypeDeclaration.ts, 14, 5)) |
| 36 | + |
| 37 | +// or in a declared class |
| 38 | +declare class Foo5 { [s5]: number; } |
| 39 | +>Foo5 : Symbol(Foo5, Decl(forwardRefInTypeDeclaration.ts, 14, 15)) |
| 40 | +>[s5] : Symbol(Foo5[s5], Decl(forwardRefInTypeDeclaration.ts, 17, 20)) |
| 41 | +>s5 : Symbol(s5, Decl(forwardRefInTypeDeclaration.ts, 18, 5)) |
| 42 | + |
| 43 | +const s5 = "x"; |
| 44 | +>s5 : Symbol(s5, Decl(forwardRefInTypeDeclaration.ts, 18, 5)) |
| 45 | + |
| 46 | +// or with qualified names |
| 47 | +interface Foo6 { [Cls1.a]: number; [Cls2.b]: number; [obj1.c]: number; [obj2.d]: number } |
| 48 | +>Foo6 : Symbol(Foo6, Decl(forwardRefInTypeDeclaration.ts, 18, 15)) |
| 49 | +>[Cls1.a] : Symbol(Foo6[Cls1.a], Decl(forwardRefInTypeDeclaration.ts, 21, 16)) |
| 50 | +>Cls1.a : Symbol(Cls1.a, Decl(forwardRefInTypeDeclaration.ts, 22, 20)) |
| 51 | +>Cls1 : Symbol(Cls1, Decl(forwardRefInTypeDeclaration.ts, 21, 89)) |
| 52 | +>a : Symbol(Cls1.a, Decl(forwardRefInTypeDeclaration.ts, 22, 20)) |
| 53 | +>[Cls2.b] : Symbol(Foo6[Cls2.b], Decl(forwardRefInTypeDeclaration.ts, 21, 34)) |
| 54 | +>Cls2.b : Symbol(Cls2.b, Decl(forwardRefInTypeDeclaration.ts, 23, 12)) |
| 55 | +>Cls2 : Symbol(Cls2, Decl(forwardRefInTypeDeclaration.ts, 22, 37)) |
| 56 | +>b : Symbol(Cls2.b, Decl(forwardRefInTypeDeclaration.ts, 23, 12)) |
| 57 | +>[obj1.c] : Symbol(Foo6[obj1.c], Decl(forwardRefInTypeDeclaration.ts, 21, 52)) |
| 58 | +>obj1.c : Symbol(c, Decl(forwardRefInTypeDeclaration.ts, 24, 21)) |
| 59 | +>obj1 : Symbol(obj1, Decl(forwardRefInTypeDeclaration.ts, 24, 13)) |
| 60 | +>c : Symbol(c, Decl(forwardRefInTypeDeclaration.ts, 24, 21)) |
| 61 | +>[obj2.d] : Symbol(Foo6[obj2.d], Decl(forwardRefInTypeDeclaration.ts, 21, 70)) |
| 62 | +>obj2.d : Symbol(d, Decl(forwardRefInTypeDeclaration.ts, 25, 14)) |
| 63 | +>obj2 : Symbol(obj2, Decl(forwardRefInTypeDeclaration.ts, 25, 5)) |
| 64 | +>d : Symbol(d, Decl(forwardRefInTypeDeclaration.ts, 25, 14)) |
| 65 | + |
| 66 | +declare class Cls1 { static a: "a"; } |
| 67 | +>Cls1 : Symbol(Cls1, Decl(forwardRefInTypeDeclaration.ts, 21, 89)) |
| 68 | +>a : Symbol(Cls1.a, Decl(forwardRefInTypeDeclaration.ts, 22, 20)) |
| 69 | + |
| 70 | +class Cls2 { static b = "b" as const; } |
| 71 | +>Cls2 : Symbol(Cls2, Decl(forwardRefInTypeDeclaration.ts, 22, 37)) |
| 72 | +>b : Symbol(Cls2.b, Decl(forwardRefInTypeDeclaration.ts, 23, 12)) |
| 73 | +>const : Symbol(const) |
| 74 | + |
| 75 | +declare const obj1: { c: 'c' } |
| 76 | +>obj1 : Symbol(obj1, Decl(forwardRefInTypeDeclaration.ts, 24, 13)) |
| 77 | +>c : Symbol(c, Decl(forwardRefInTypeDeclaration.ts, 24, 21)) |
| 78 | + |
| 79 | +const obj2 = { d: 'd' } as const |
| 80 | +>obj2 : Symbol(obj2, Decl(forwardRefInTypeDeclaration.ts, 25, 5)) |
| 81 | +>d : Symbol(d, Decl(forwardRefInTypeDeclaration.ts, 25, 14)) |
| 82 | +>const : Symbol(const) |
| 83 | + |
0 commit comments