From 39db00e58884e2bab5aef2dd85d239c916465261 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Tue, 6 Feb 2018 17:33:09 -0800 Subject: [PATCH] Accept new baselines --- .../reference/inferTypes1.errors.txt | 28 ++- tests/baselines/reference/inferTypes1.js | 21 ++ tests/baselines/reference/inferTypes1.symbols | 222 ++++++++++++++---- tests/baselines/reference/inferTypes1.types | 122 ++++++++++ 4 files changed, 342 insertions(+), 51 deletions(-) diff --git a/tests/baselines/reference/inferTypes1.errors.txt b/tests/baselines/reference/inferTypes1.errors.txt index ff93491dd1d..d8dea7d9868 100644 --- a/tests/baselines/reference/inferTypes1.errors.txt +++ b/tests/baselines/reference/inferTypes1.errors.txt @@ -10,9 +10,11 @@ tests/cases/conformance/types/conditional/inferTypes1.ts(72,15): error TS2304: C tests/cases/conformance/types/conditional/inferTypes1.ts(72,15): error TS4081: Exported type alias 'T62' has or is using private name 'U'. tests/cases/conformance/types/conditional/inferTypes1.ts(72,43): error TS2304: Cannot find name 'U'. tests/cases/conformance/types/conditional/inferTypes1.ts(72,43): error TS4081: Exported type alias 'T62' has or is using private name 'U'. +tests/cases/conformance/types/conditional/inferTypes1.ts(78,44): error TS2344: Type 'U' does not satisfy the constraint 'string'. + Type 'number' is not assignable to type 'string'. -==== tests/cases/conformance/types/conditional/inferTypes1.ts (11 errors) ==== +==== tests/cases/conformance/types/conditional/inferTypes1.ts (12 errors) ==== type Unpacked = T extends (infer U)[] ? U : T extends (...args: any[]) => infer U ? U : @@ -109,6 +111,21 @@ tests/cases/conformance/types/conditional/inferTypes1.ts(72,43): error TS4081: E ~ !!! error TS4081: Exported type alias 'T62' has or is using private name 'U'. + type T70 = { x: T }; + type T71 = T extends T70 ? T70 : never; + + type T72 = { y: T }; + type T73 = T extends T72 ? T70 : never; // Error + ~ +!!! error TS2344: Type 'U' does not satisfy the constraint 'string'. +!!! error TS2344: Type 'number' is not assignable to type 'string'. + + type T74 = { x: T, y: U }; + type T75 = T extends T74 ? T70 | T72 | T74 : never; + + type T76 = { x: T }; + type T77 = T extends T76 ? T76: never; + // Example from #21496 type JsonifiedObject = { [K in keyof T]: Jsonified }; @@ -140,4 +157,13 @@ tests/cases/conformance/types/conditional/inferTypes1.ts(72,43): error TS4081: E declare let ex: JsonifiedExample; const z1: "correct" = ex.customClass; const z2: string = ex.obj.nested.attr; + + // Repros from #21631 + + type A1> = [T, U]; + type B1 = S extends A1 ? [T, U] : never; + + type A2 = [T, U]; + type B2 = S extends A2 ? [T, U] : never; + type C2 = S extends A2 ? [T, U] : never; \ No newline at end of file diff --git a/tests/baselines/reference/inferTypes1.js b/tests/baselines/reference/inferTypes1.js index 5a692fe8d05..f916464f2fe 100644 --- a/tests/baselines/reference/inferTypes1.js +++ b/tests/baselines/reference/inferTypes1.js @@ -72,6 +72,18 @@ type T60 = infer U; // Error type T61 = infer A extends infer B ? infer C : infer D; // Error type T62 = U extends (infer U)[] ? U : U; // Error +type T70 = { x: T }; +type T71 = T extends T70 ? T70 : never; + +type T72 = { y: T }; +type T73 = T extends T72 ? T70 : never; // Error + +type T74 = { x: T, y: U }; +type T75 = T extends T74 ? T70 | T72 | T74 : never; + +type T76 = { x: T }; +type T77 = T extends T76 ? T76: never; + // Example from #21496 type JsonifiedObject = { [K in keyof T]: Jsonified }; @@ -103,6 +115,15 @@ type JsonifiedExample = Jsonified; declare let ex: JsonifiedExample; const z1: "correct" = ex.customClass; const z2: string = ex.obj.nested.attr; + +// Repros from #21631 + +type A1> = [T, U]; +type B1 = S extends A1 ? [T, U] : never; + +type A2 = [T, U]; +type B2 = S extends A2 ? [T, U] : never; +type C2 = S extends A2 ? [T, U] : never; //// [inferTypes1.js] diff --git a/tests/baselines/reference/inferTypes1.symbols b/tests/baselines/reference/inferTypes1.symbols index 18674d957a8..e3772e89f01 100644 --- a/tests/baselines/reference/inferTypes1.symbols +++ b/tests/baselines/reference/inferTypes1.symbols @@ -315,106 +315,228 @@ type T62 = U extends (infer U)[] ? U : U; // Error >U : Symbol(U, Decl(inferTypes1.ts, 71, 30)) >U : Symbol(U, Decl(inferTypes1.ts, 71, 30)) +type T70 = { x: T }; +>T70 : Symbol(T70, Decl(inferTypes1.ts, 71, 44)) +>T : Symbol(T, Decl(inferTypes1.ts, 73, 9)) +>x : Symbol(x, Decl(inferTypes1.ts, 73, 30)) +>T : Symbol(T, Decl(inferTypes1.ts, 73, 9)) + +type T71 = T extends T70 ? T70 : never; +>T71 : Symbol(T71, Decl(inferTypes1.ts, 73, 38)) +>T : Symbol(T, Decl(inferTypes1.ts, 74, 9)) +>T : Symbol(T, Decl(inferTypes1.ts, 74, 9)) +>T70 : Symbol(T70, Decl(inferTypes1.ts, 71, 44)) +>U : Symbol(U, Decl(inferTypes1.ts, 74, 33)) +>T70 : Symbol(T70, Decl(inferTypes1.ts, 71, 44)) +>U : Symbol(U, Decl(inferTypes1.ts, 74, 33)) + +type T72 = { y: T }; +>T72 : Symbol(T72, Decl(inferTypes1.ts, 74, 54)) +>T : Symbol(T, Decl(inferTypes1.ts, 76, 9)) +>y : Symbol(y, Decl(inferTypes1.ts, 76, 30)) +>T : Symbol(T, Decl(inferTypes1.ts, 76, 9)) + +type T73 = T extends T72 ? T70 : never; // Error +>T73 : Symbol(T73, Decl(inferTypes1.ts, 76, 38)) +>T : Symbol(T, Decl(inferTypes1.ts, 77, 9)) +>T : Symbol(T, Decl(inferTypes1.ts, 77, 9)) +>T72 : Symbol(T72, Decl(inferTypes1.ts, 74, 54)) +>U : Symbol(U, Decl(inferTypes1.ts, 77, 33)) +>T70 : Symbol(T70, Decl(inferTypes1.ts, 71, 44)) +>U : Symbol(U, Decl(inferTypes1.ts, 77, 33)) + +type T74 = { x: T, y: U }; +>T74 : Symbol(T74, Decl(inferTypes1.ts, 77, 54)) +>T : Symbol(T, Decl(inferTypes1.ts, 79, 9)) +>U : Symbol(U, Decl(inferTypes1.ts, 79, 26)) +>x : Symbol(x, Decl(inferTypes1.ts, 79, 48)) +>T : Symbol(T, Decl(inferTypes1.ts, 79, 9)) +>y : Symbol(y, Decl(inferTypes1.ts, 79, 54)) +>U : Symbol(U, Decl(inferTypes1.ts, 79, 26)) + +type T75 = T extends T74 ? T70 | T72 | T74 : never; +>T75 : Symbol(T75, Decl(inferTypes1.ts, 79, 62)) +>T : Symbol(T, Decl(inferTypes1.ts, 80, 9)) +>T : Symbol(T, Decl(inferTypes1.ts, 80, 9)) +>T74 : Symbol(T74, Decl(inferTypes1.ts, 77, 54)) +>U : Symbol(U, Decl(inferTypes1.ts, 80, 33), Decl(inferTypes1.ts, 80, 42)) +>U : Symbol(U, Decl(inferTypes1.ts, 80, 33), Decl(inferTypes1.ts, 80, 42)) +>T70 : Symbol(T70, Decl(inferTypes1.ts, 71, 44)) +>U : Symbol(U, Decl(inferTypes1.ts, 80, 33), Decl(inferTypes1.ts, 80, 42)) +>T72 : Symbol(T72, Decl(inferTypes1.ts, 74, 54)) +>U : Symbol(U, Decl(inferTypes1.ts, 80, 33), Decl(inferTypes1.ts, 80, 42)) +>T74 : Symbol(T74, Decl(inferTypes1.ts, 77, 54)) +>U : Symbol(U, Decl(inferTypes1.ts, 80, 33), Decl(inferTypes1.ts, 80, 42)) +>U : Symbol(U, Decl(inferTypes1.ts, 80, 33), Decl(inferTypes1.ts, 80, 42)) + +type T76 = { x: T }; +>T76 : Symbol(T76, Decl(inferTypes1.ts, 80, 84)) +>T : Symbol(T, Decl(inferTypes1.ts, 82, 9)) +>T : Symbol(T, Decl(inferTypes1.ts, 82, 9)) +>U : Symbol(U, Decl(inferTypes1.ts, 82, 23)) +>T : Symbol(T, Decl(inferTypes1.ts, 82, 9)) +>x : Symbol(x, Decl(inferTypes1.ts, 82, 40)) +>T : Symbol(T, Decl(inferTypes1.ts, 82, 9)) + +type T77 = T extends T76 ? T76: never; +>T77 : Symbol(T77, Decl(inferTypes1.ts, 82, 48)) +>T : Symbol(T, Decl(inferTypes1.ts, 83, 9)) +>T : Symbol(T, Decl(inferTypes1.ts, 83, 9)) +>T76 : Symbol(T76, Decl(inferTypes1.ts, 80, 84)) +>X : Symbol(X, Decl(inferTypes1.ts, 83, 33)) +>Y : Symbol(Y, Decl(inferTypes1.ts, 83, 42)) +>T76 : Symbol(T76, Decl(inferTypes1.ts, 80, 84)) +>X : Symbol(X, Decl(inferTypes1.ts, 83, 33)) +>Y : Symbol(Y, Decl(inferTypes1.ts, 83, 42)) + // Example from #21496 type JsonifiedObject = { [K in keyof T]: Jsonified }; ->JsonifiedObject : Symbol(JsonifiedObject, Decl(inferTypes1.ts, 71, 44)) ->T : Symbol(T, Decl(inferTypes1.ts, 75, 21)) ->K : Symbol(K, Decl(inferTypes1.ts, 75, 44)) ->T : Symbol(T, Decl(inferTypes1.ts, 75, 21)) ->Jsonified : Symbol(Jsonified, Decl(inferTypes1.ts, 75, 77)) ->T : Symbol(T, Decl(inferTypes1.ts, 75, 21)) ->K : Symbol(K, Decl(inferTypes1.ts, 75, 44)) +>JsonifiedObject : Symbol(JsonifiedObject, Decl(inferTypes1.ts, 83, 65)) +>T : Symbol(T, Decl(inferTypes1.ts, 87, 21)) +>K : Symbol(K, Decl(inferTypes1.ts, 87, 44)) +>T : Symbol(T, Decl(inferTypes1.ts, 87, 21)) +>Jsonified : Symbol(Jsonified, Decl(inferTypes1.ts, 87, 77)) +>T : Symbol(T, Decl(inferTypes1.ts, 87, 21)) +>K : Symbol(K, Decl(inferTypes1.ts, 87, 44)) type Jsonified = ->Jsonified : Symbol(Jsonified, Decl(inferTypes1.ts, 75, 77)) ->T : Symbol(T, Decl(inferTypes1.ts, 77, 15)) +>Jsonified : Symbol(Jsonified, Decl(inferTypes1.ts, 87, 77)) +>T : Symbol(T, Decl(inferTypes1.ts, 89, 15)) T extends string | number | boolean | null ? T ->T : Symbol(T, Decl(inferTypes1.ts, 77, 15)) ->T : Symbol(T, Decl(inferTypes1.ts, 77, 15)) +>T : Symbol(T, Decl(inferTypes1.ts, 89, 15)) +>T : Symbol(T, Decl(inferTypes1.ts, 89, 15)) : T extends undefined | Function ? never // undefined and functions are removed ->T : Symbol(T, Decl(inferTypes1.ts, 77, 15)) +>T : Symbol(T, Decl(inferTypes1.ts, 89, 15)) >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) : T extends { toJSON(): infer R } ? R // toJSON is called if it exists (e.g. Date) ->T : Symbol(T, Decl(inferTypes1.ts, 77, 15)) ->toJSON : Symbol(toJSON, Decl(inferTypes1.ts, 80, 17)) ->R : Symbol(R, Decl(inferTypes1.ts, 80, 33)) ->R : Symbol(R, Decl(inferTypes1.ts, 80, 33)) +>T : Symbol(T, Decl(inferTypes1.ts, 89, 15)) +>toJSON : Symbol(toJSON, Decl(inferTypes1.ts, 92, 17)) +>R : Symbol(R, Decl(inferTypes1.ts, 92, 33)) +>R : Symbol(R, Decl(inferTypes1.ts, 92, 33)) : T extends object ? JsonifiedObject ->T : Symbol(T, Decl(inferTypes1.ts, 77, 15)) ->JsonifiedObject : Symbol(JsonifiedObject, Decl(inferTypes1.ts, 71, 44)) ->T : Symbol(T, Decl(inferTypes1.ts, 77, 15)) +>T : Symbol(T, Decl(inferTypes1.ts, 89, 15)) +>JsonifiedObject : Symbol(JsonifiedObject, Decl(inferTypes1.ts, 83, 65)) +>T : Symbol(T, Decl(inferTypes1.ts, 89, 15)) : "what is this"; type Example = { ->Example : Symbol(Example, Decl(inferTypes1.ts, 82, 21)) +>Example : Symbol(Example, Decl(inferTypes1.ts, 94, 21)) str: "literalstring", ->str : Symbol(str, Decl(inferTypes1.ts, 84, 16)) +>str : Symbol(str, Decl(inferTypes1.ts, 96, 16)) fn: () => void, ->fn : Symbol(fn, Decl(inferTypes1.ts, 85, 25)) +>fn : Symbol(fn, Decl(inferTypes1.ts, 97, 25)) date: Date, ->date : Symbol(date, Decl(inferTypes1.ts, 86, 19)) +>date : Symbol(date, Decl(inferTypes1.ts, 98, 19)) >Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) customClass: MyClass, ->customClass : Symbol(customClass, Decl(inferTypes1.ts, 87, 15)) ->MyClass : Symbol(MyClass, Decl(inferTypes1.ts, 94, 1)) +>customClass : Symbol(customClass, Decl(inferTypes1.ts, 99, 15)) +>MyClass : Symbol(MyClass, Decl(inferTypes1.ts, 106, 1)) obj: { ->obj : Symbol(obj, Decl(inferTypes1.ts, 88, 25)) +>obj : Symbol(obj, Decl(inferTypes1.ts, 100, 25)) prop: "property", ->prop : Symbol(prop, Decl(inferTypes1.ts, 89, 10)) +>prop : Symbol(prop, Decl(inferTypes1.ts, 101, 10)) clz: MyClass, ->clz : Symbol(clz, Decl(inferTypes1.ts, 90, 25)) ->MyClass : Symbol(MyClass, Decl(inferTypes1.ts, 94, 1)) +>clz : Symbol(clz, Decl(inferTypes1.ts, 102, 25)) +>MyClass : Symbol(MyClass, Decl(inferTypes1.ts, 106, 1)) nested: { attr: Date } ->nested : Symbol(nested, Decl(inferTypes1.ts, 91, 21)) ->attr : Symbol(attr, Decl(inferTypes1.ts, 92, 17)) +>nested : Symbol(nested, Decl(inferTypes1.ts, 103, 21)) +>attr : Symbol(attr, Decl(inferTypes1.ts, 104, 17)) >Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) }, } declare class MyClass { ->MyClass : Symbol(MyClass, Decl(inferTypes1.ts, 94, 1)) +>MyClass : Symbol(MyClass, Decl(inferTypes1.ts, 106, 1)) toJSON(): "correct"; ->toJSON : Symbol(MyClass.toJSON, Decl(inferTypes1.ts, 96, 23)) +>toJSON : Symbol(MyClass.toJSON, Decl(inferTypes1.ts, 108, 23)) } type JsonifiedExample = Jsonified; ->JsonifiedExample : Symbol(JsonifiedExample, Decl(inferTypes1.ts, 98, 1)) ->Jsonified : Symbol(Jsonified, Decl(inferTypes1.ts, 75, 77)) ->Example : Symbol(Example, Decl(inferTypes1.ts, 82, 21)) +>JsonifiedExample : Symbol(JsonifiedExample, Decl(inferTypes1.ts, 110, 1)) +>Jsonified : Symbol(Jsonified, Decl(inferTypes1.ts, 87, 77)) +>Example : Symbol(Example, Decl(inferTypes1.ts, 94, 21)) declare let ex: JsonifiedExample; ->ex : Symbol(ex, Decl(inferTypes1.ts, 101, 11)) ->JsonifiedExample : Symbol(JsonifiedExample, Decl(inferTypes1.ts, 98, 1)) +>ex : Symbol(ex, Decl(inferTypes1.ts, 113, 11)) +>JsonifiedExample : Symbol(JsonifiedExample, Decl(inferTypes1.ts, 110, 1)) const z1: "correct" = ex.customClass; ->z1 : Symbol(z1, Decl(inferTypes1.ts, 102, 5)) ->ex.customClass : Symbol(customClass, Decl(inferTypes1.ts, 87, 15)) ->ex : Symbol(ex, Decl(inferTypes1.ts, 101, 11)) ->customClass : Symbol(customClass, Decl(inferTypes1.ts, 87, 15)) +>z1 : Symbol(z1, Decl(inferTypes1.ts, 114, 5)) +>ex.customClass : Symbol(customClass, Decl(inferTypes1.ts, 99, 15)) +>ex : Symbol(ex, Decl(inferTypes1.ts, 113, 11)) +>customClass : Symbol(customClass, Decl(inferTypes1.ts, 99, 15)) const z2: string = ex.obj.nested.attr; ->z2 : Symbol(z2, Decl(inferTypes1.ts, 103, 5)) ->ex.obj.nested.attr : Symbol(attr, Decl(inferTypes1.ts, 92, 17)) ->ex.obj.nested : Symbol(nested, Decl(inferTypes1.ts, 91, 21)) ->ex.obj : Symbol(obj, Decl(inferTypes1.ts, 88, 25)) ->ex : Symbol(ex, Decl(inferTypes1.ts, 101, 11)) ->obj : Symbol(obj, Decl(inferTypes1.ts, 88, 25)) ->nested : Symbol(nested, Decl(inferTypes1.ts, 91, 21)) ->attr : Symbol(attr, Decl(inferTypes1.ts, 92, 17)) +>z2 : Symbol(z2, Decl(inferTypes1.ts, 115, 5)) +>ex.obj.nested.attr : Symbol(attr, Decl(inferTypes1.ts, 104, 17)) +>ex.obj.nested : Symbol(nested, Decl(inferTypes1.ts, 103, 21)) +>ex.obj : Symbol(obj, Decl(inferTypes1.ts, 100, 25)) +>ex : Symbol(ex, Decl(inferTypes1.ts, 113, 11)) +>obj : Symbol(obj, Decl(inferTypes1.ts, 100, 25)) +>nested : Symbol(nested, Decl(inferTypes1.ts, 103, 21)) +>attr : Symbol(attr, Decl(inferTypes1.ts, 104, 17)) + +// Repros from #21631 + +type A1> = [T, U]; +>A1 : Symbol(A1, Decl(inferTypes1.ts, 115, 38)) +>T : Symbol(T, Decl(inferTypes1.ts, 119, 8)) +>U : Symbol(U, Decl(inferTypes1.ts, 119, 10)) +>A1 : Symbol(A1, Decl(inferTypes1.ts, 115, 38)) +>T : Symbol(T, Decl(inferTypes1.ts, 119, 8)) +>U : Symbol(U, Decl(inferTypes1.ts, 119, 10)) + +type B1 = S extends A1 ? [T, U] : never; +>B1 : Symbol(B1, Decl(inferTypes1.ts, 119, 44)) +>S : Symbol(S, Decl(inferTypes1.ts, 120, 8)) +>S : Symbol(S, Decl(inferTypes1.ts, 120, 8)) +>A1 : Symbol(A1, Decl(inferTypes1.ts, 115, 38)) +>T : Symbol(T, Decl(inferTypes1.ts, 120, 31)) +>U : Symbol(U, Decl(inferTypes1.ts, 120, 40)) +>T : Symbol(T, Decl(inferTypes1.ts, 120, 31)) +>U : Symbol(U, Decl(inferTypes1.ts, 120, 40)) + +type A2 = [T, U]; +>A2 : Symbol(A2, Decl(inferTypes1.ts, 120, 61)) +>T : Symbol(T, Decl(inferTypes1.ts, 122, 8)) +>U : Symbol(U, Decl(inferTypes1.ts, 122, 10)) +>T : Symbol(T, Decl(inferTypes1.ts, 122, 8)) +>U : Symbol(U, Decl(inferTypes1.ts, 122, 10)) + +type B2 = S extends A2 ? [T, U] : never; +>B2 : Symbol(B2, Decl(inferTypes1.ts, 122, 36)) +>S : Symbol(S, Decl(inferTypes1.ts, 123, 8)) +>S : Symbol(S, Decl(inferTypes1.ts, 123, 8)) +>A2 : Symbol(A2, Decl(inferTypes1.ts, 120, 61)) +>T : Symbol(T, Decl(inferTypes1.ts, 123, 31)) +>U : Symbol(U, Decl(inferTypes1.ts, 123, 40)) +>T : Symbol(T, Decl(inferTypes1.ts, 123, 31)) +>U : Symbol(U, Decl(inferTypes1.ts, 123, 40)) + +type C2 = S extends A2 ? [T, U] : never; +>C2 : Symbol(C2, Decl(inferTypes1.ts, 123, 61)) +>S : Symbol(S, Decl(inferTypes1.ts, 124, 8)) +>U : Symbol(U, Decl(inferTypes1.ts, 124, 10)) +>S : Symbol(S, Decl(inferTypes1.ts, 124, 8)) +>A2 : Symbol(A2, Decl(inferTypes1.ts, 120, 61)) +>T : Symbol(T, Decl(inferTypes1.ts, 124, 47)) +>U : Symbol(U, Decl(inferTypes1.ts, 124, 10)) +>T : Symbol(T, Decl(inferTypes1.ts, 124, 47)) +>U : Symbol(U, Decl(inferTypes1.ts, 124, 10)) diff --git a/tests/baselines/reference/inferTypes1.types b/tests/baselines/reference/inferTypes1.types index 0b753c30f49..4f050958773 100644 --- a/tests/baselines/reference/inferTypes1.types +++ b/tests/baselines/reference/inferTypes1.types @@ -321,6 +321,80 @@ type T62 = U extends (infer U)[] ? U : U; // Error >U : U >U : No type information available! +type T70 = { x: T }; +>T70 : T70 +>T : T +>x : T +>T : T + +type T71 = T extends T70 ? T70 : never; +>T71 : T71 +>T : T +>T : T +>T70 : T70 +>U : U +>T70 : T70 +>U : U + +type T72 = { y: T }; +>T72 : T72 +>T : T +>y : T +>T : T + +type T73 = T extends T72 ? T70 : never; // Error +>T73 : T73 +>T : T +>T : T +>T72 : T72 +>U : U +>T70 : T70 +>U : U + +type T74 = { x: T, y: U }; +>T74 : T74 +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U + +type T75 = T extends T74 ? T70 | T72 | T74 : never; +>T75 : T75 +>T : T +>T : T +>T74 : T74 +>U : U +>U : U +>T70 : T70 +>U : U +>T72 : T72 +>U : U +>T74 : T74 +>U : U +>U : U + +type T76 = { x: T }; +>T76 : T76 +>T : T +>T : T +>U : U +>T : T +>x : T +>T : T + +type T77 = T extends T76 ? T76: never; +>T77 : T77 +>T : T +>T : T +>T76 : T76 +>X : X +>Y : Y +>T76 : T76 +>X : X +>Y : Y + // Example from #21496 type JsonifiedObject = { [K in keyof T]: Jsonified }; @@ -425,3 +499,51 @@ const z2: string = ex.obj.nested.attr; >nested : JsonifiedObject<{ attr: Date; }> >attr : string +// Repros from #21631 + +type A1> = [T, U]; +>A1 : [T, U] +>T : T +>U : U +>A1 : [T, U] +>T : T +>U : U + +type B1 = S extends A1 ? [T, U] : never; +>B1 : B1 +>S : S +>S : S +>A1 : [T, U] +>T : T +>U : U +>T : T +>U : U + +type A2 = [T, U]; +>A2 : [T, U] +>T : T +>U : U +>T : T +>U : U + +type B2 = S extends A2 ? [T, U] : never; +>B2 : B2 +>S : S +>S : S +>A2 : [T, U] +>T : T +>U : U +>T : T +>U : U + +type C2 = S extends A2 ? [T, U] : never; +>C2 : C2 +>S : S +>U : U +>S : S +>A2 : [T, U] +>T : T +>U : U +>T : T +>U : U +