|
| 1 | +=== tests/cases/compiler/dontWiden.ts === |
| 2 | +const c = [1, 'a']; |
| 3 | +>c : Symbol(c, Decl(dontWiden.ts, 0, 5)) |
| 4 | + |
| 5 | +const d = { a: 1, b: 'c' }; |
| 6 | +>d : Symbol(d, Decl(dontWiden.ts, 1, 5)) |
| 7 | +>a : Symbol(a, Decl(dontWiden.ts, 1, 11)) |
| 8 | +>b : Symbol(b, Decl(dontWiden.ts, 1, 17)) |
| 9 | + |
| 10 | +interface SomeInterface { a: boolean } |
| 11 | +>SomeInterface : Symbol(SomeInterface, Decl(dontWiden.ts, 1, 27)) |
| 12 | +>a : Symbol(SomeInterface.a, Decl(dontWiden.ts, 3, 25)) |
| 13 | + |
| 14 | +declare function foo<T extends any[]>(arg: T): { hi: T }; |
| 15 | +>foo : Symbol(foo, Decl(dontWiden.ts, 3, 38)) |
| 16 | +>T : Symbol(T, Decl(dontWiden.ts, 4, 21)) |
| 17 | +>arg : Symbol(arg, Decl(dontWiden.ts, 4, 38)) |
| 18 | +>T : Symbol(T, Decl(dontWiden.ts, 4, 21)) |
| 19 | +>hi : Symbol(hi, Decl(dontWiden.ts, 4, 48)) |
| 20 | +>T : Symbol(T, Decl(dontWiden.ts, 4, 21)) |
| 21 | + |
| 22 | +declare function boo<T extends number[]>(arg: T): { hi: T }; |
| 23 | +>boo : Symbol(boo, Decl(dontWiden.ts, 4, 57)) |
| 24 | +>T : Symbol(T, Decl(dontWiden.ts, 5, 21)) |
| 25 | +>arg : Symbol(arg, Decl(dontWiden.ts, 5, 41)) |
| 26 | +>T : Symbol(T, Decl(dontWiden.ts, 5, 21)) |
| 27 | +>hi : Symbol(hi, Decl(dontWiden.ts, 5, 51)) |
| 28 | +>T : Symbol(T, Decl(dontWiden.ts, 5, 21)) |
| 29 | + |
| 30 | +declare function bar(arg: SomeInterface): void |
| 31 | +>bar : Symbol(bar, Decl(dontWiden.ts, 5, 60)) |
| 32 | +>arg : Symbol(arg, Decl(dontWiden.ts, 6, 21)) |
| 33 | +>SomeInterface : Symbol(SomeInterface, Decl(dontWiden.ts, 1, 27)) |
| 34 | + |
| 35 | +declare function baz(arg: [number, 2, 3 | number]): void |
| 36 | +>baz : Symbol(baz, Decl(dontWiden.ts, 6, 46)) |
| 37 | +>arg : Symbol(arg, Decl(dontWiden.ts, 7, 21)) |
| 38 | + |
| 39 | +declare function bag(arg: number[]): void |
| 40 | +>bag : Symbol(bag, Decl(dontWiden.ts, 7, 56)) |
| 41 | +>arg : Symbol(arg, Decl(dontWiden.ts, 8, 21)) |
| 42 | + |
| 43 | +// As variable assignees |
| 44 | +const a: number[] = [1, 2, 3]; |
| 45 | +>a : Symbol(a, Decl(dontWiden.ts, 11, 5)) |
| 46 | + |
| 47 | +const b: SomeInterface = {a: true}; |
| 48 | +>b : Symbol(b, Decl(dontWiden.ts, 12, 5)) |
| 49 | +>SomeInterface : Symbol(SomeInterface, Decl(dontWiden.ts, 1, 27)) |
| 50 | +>a : Symbol(a, Decl(dontWiden.ts, 12, 26)) |
| 51 | + |
| 52 | +const e = [1, 2, 3]; |
| 53 | +>e : Symbol(e, Decl(dontWiden.ts, 13, 5)) |
| 54 | + |
| 55 | +// Same, but as arguments |
| 56 | +foo([1, 2, 3]); |
| 57 | +>foo : Symbol(foo, Decl(dontWiden.ts, 3, 38)) |
| 58 | + |
| 59 | +bar({a: true}); |
| 60 | +>bar : Symbol(bar, Decl(dontWiden.ts, 5, 60)) |
| 61 | +>a : Symbol(a, Decl(dontWiden.ts, 17, 5)) |
| 62 | + |
| 63 | +baz([1, 2, 3]); |
| 64 | +>baz : Symbol(baz, Decl(dontWiden.ts, 6, 46)) |
| 65 | + |
| 66 | +bag([1, 2, 3]); |
| 67 | +>bag : Symbol(bag, Decl(dontWiden.ts, 7, 56)) |
| 68 | + |
| 69 | +bag(e); |
| 70 | +>bag : Symbol(bag, Decl(dontWiden.ts, 7, 56)) |
| 71 | +>e : Symbol(e, Decl(dontWiden.ts, 13, 5)) |
| 72 | + |
| 73 | +boo([1, 2, 3]); |
| 74 | +>boo : Symbol(boo, Decl(dontWiden.ts, 4, 57)) |
| 75 | + |
| 76 | +boo(e); |
| 77 | +>boo : Symbol(boo, Decl(dontWiden.ts, 4, 57)) |
| 78 | +>e : Symbol(e, Decl(dontWiden.ts, 13, 5)) |
| 79 | + |
0 commit comments