diff --git a/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt b/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt index 996ddba323f..5e49aa37b6c 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt +++ b/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt @@ -26,6 +26,24 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(67,3): error TS232 tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(68,3): error TS2322: Type '123' is not assignable to type 'T[K]'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS2322: Type '123' is not assignable to type 'Type[K]'. Type '123' is not assignable to type 'never'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(126,1): error TS2322: Type 'Demo<{ b: string; }>' is not assignable to type 'Demo<{ a: number; }>'. + Types of parameters 'key' and 'key' are incompatible. + Type '"a"' is not assignable to type '"b"'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(127,1): error TS2322: Type 'Demo<{ a: number; b: string; }>' is not assignable to type 'Demo<{ a: number; }>'. + Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(128,1): error TS2322: Type 'Demo<{ a: number; }>' is not assignable to type 'Demo<{ b: string; }>'. + Types of parameters 'key' and 'key' are incompatible. + Type '"b"' is not assignable to type '"a"'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(129,1): error TS2322: Type 'Demo<{ a: number; b: string; }>' is not assignable to type 'Demo<{ b: string; }>'. + Property 'a' is missing in type '{ b: string; }' but required in type '{ a: number; b: string; }'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(130,1): error TS2322: Type 'Demo<{ a: number; }>' is not assignable to type 'Demo<{ a: number; b: string; }>'. + Types of parameters 'key' and 'key' are incompatible. + Type '"a" | "b"' is not assignable to type '"a"'. + Type '"b"' is not assignable to type '"a"'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(131,1): error TS2322: Type 'Demo<{ b: string; }>' is not assignable to type 'Demo<{ a: number; b: string; }>'. + Types of parameters 'key' and 'key' are incompatible. + Type '"a" | "b"' is not assignable to type '"b"'. + Type '"a"' is not assignable to type '"b"'. ==== tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts (29 errors) ==== @@ -210,23 +228,19 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS23 !!! error TS2322: Type 'Demo<{ b: string; }>' is not assignable to type 'Demo<{ a: number; }>'. !!! error TS2322: Types of parameters 'key' and 'key' are incompatible. !!! error TS2322: Type '"a"' is not assignable to type '"b"'. -!!! related TS2728 tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts:122:24: 'a' is declared here. da = dc; ~~ !!! error TS2322: Type 'Demo<{ a: number; b: string; }>' is not assignable to type 'Demo<{ a: number; }>'. !!! error TS2322: Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. -!!! related TS2728 tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts:124:35: 'b' is declared here. db = da; // Error ~~ !!! error TS2322: Type 'Demo<{ a: number; }>' is not assignable to type 'Demo<{ b: string; }>'. !!! error TS2322: Types of parameters 'key' and 'key' are incompatible. !!! error TS2322: Type '"b"' is not assignable to type '"a"'. -!!! related TS2728 tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts:123:24: 'b' is declared here. db = dc; ~~ !!! error TS2322: Type 'Demo<{ a: number; b: string; }>' is not assignable to type 'Demo<{ b: string; }>'. !!! error TS2322: Property 'a' is missing in type '{ b: string; }' but required in type '{ a: number; b: string; }'. -!!! related TS2728 tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts:124:24: 'a' is declared here. dc = da; // Error ~~ !!! error TS2322: Type 'Demo<{ a: number; }>' is not assignable to type 'Demo<{ a: number; b: string; }>'. diff --git a/tests/baselines/reference/keyofAndIndexedAccess2.symbols b/tests/baselines/reference/keyofAndIndexedAccess2.symbols index 619e7e3f87e..2acf707c38d 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess2.symbols +++ b/tests/baselines/reference/keyofAndIndexedAccess2.symbols @@ -566,7 +566,7 @@ export class c { constructor() { this.a = "b"; ->this : Symbol(c, Decl(keyofAndIndexedAccess2.ts, 136, 1)) +>this : Symbol(c, Decl(keyofAndIndexedAccess2.ts, 151, 1)) this["a"] = "b"; >this : Symbol(c, Decl(keyofAndIndexedAccess2.ts, 151, 1)) @@ -576,67 +576,67 @@ export class c { // Repro from #31385 type Foo = { [key: string]: { [K in keyof T]: K }[keyof T] }; ->Foo : Symbol(Foo, Decl(keyofAndIndexedAccess2.ts, 146, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 150, 9)) ->key : Symbol(key, Decl(keyofAndIndexedAccess2.ts, 150, 17)) ->K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 150, 34)) ->T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 150, 9)) ->K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 150, 34)) ->T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 150, 9)) +>Foo : Symbol(Foo, Decl(keyofAndIndexedAccess2.ts, 161, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 165, 9)) +>key : Symbol(key, Decl(keyofAndIndexedAccess2.ts, 165, 17)) +>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 165, 34)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 165, 9)) +>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 165, 34)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 165, 9)) type Bar = { [key: string]: { [K in keyof T]: [K] }[keyof T] }; ->Bar : Symbol(Bar, Decl(keyofAndIndexedAccess2.ts, 150, 64)) ->T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 152, 9)) ->key : Symbol(key, Decl(keyofAndIndexedAccess2.ts, 152, 17)) ->K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 152, 34)) ->T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 152, 9)) ->K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 152, 34)) ->T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 152, 9)) +>Bar : Symbol(Bar, Decl(keyofAndIndexedAccess2.ts, 165, 64)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 167, 9)) +>key : Symbol(key, Decl(keyofAndIndexedAccess2.ts, 167, 17)) +>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 167, 34)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 167, 9)) +>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 167, 34)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 167, 9)) type Baz> = { [K in keyof Q]: T[Q[K]] }; ->Baz : Symbol(Baz, Decl(keyofAndIndexedAccess2.ts, 152, 66)) ->T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 154, 9)) ->Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 154, 11)) ->Foo : Symbol(Foo, Decl(keyofAndIndexedAccess2.ts, 146, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 154, 9)) ->K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 154, 35)) ->Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 154, 11)) ->T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 154, 9)) ->Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 154, 11)) ->K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 154, 35)) +>Baz : Symbol(Baz, Decl(keyofAndIndexedAccess2.ts, 167, 66)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 169, 9)) +>Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 169, 11)) +>Foo : Symbol(Foo, Decl(keyofAndIndexedAccess2.ts, 161, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 169, 9)) +>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 169, 35)) +>Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 169, 11)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 169, 9)) +>Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 169, 11)) +>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 169, 35)) type Qux> = { [K in keyof Q]: T[Q[K]["0"]] }; ->Qux : Symbol(Qux, Decl(keyofAndIndexedAccess2.ts, 154, 60)) ->T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 156, 9)) ->Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 156, 11)) ->Bar : Symbol(Bar, Decl(keyofAndIndexedAccess2.ts, 150, 64)) ->T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 156, 9)) ->K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 156, 35)) ->Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 156, 11)) ->T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 156, 9)) ->Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 156, 11)) ->K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 156, 35)) +>Qux : Symbol(Qux, Decl(keyofAndIndexedAccess2.ts, 169, 60)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 171, 9)) +>Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 171, 11)) +>Bar : Symbol(Bar, Decl(keyofAndIndexedAccess2.ts, 165, 64)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 171, 9)) +>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 171, 35)) +>Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 171, 11)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 171, 9)) +>Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 171, 11)) +>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 171, 35)) // Repro from #32038 const actions = ['resizeTo', 'resizeBy'] as const; ->actions : Symbol(actions, Decl(keyofAndIndexedAccess2.ts, 160, 5)) +>actions : Symbol(actions, Decl(keyofAndIndexedAccess2.ts, 175, 5)) for (const action of actions) { ->action : Symbol(action, Decl(keyofAndIndexedAccess2.ts, 161, 10)) ->actions : Symbol(actions, Decl(keyofAndIndexedAccess2.ts, 160, 5)) +>action : Symbol(action, Decl(keyofAndIndexedAccess2.ts, 176, 10)) +>actions : Symbol(actions, Decl(keyofAndIndexedAccess2.ts, 175, 5)) window[action] = (x, y) => { >window : Symbol(window, Decl(lib.dom.d.ts, --, --)) ->action : Symbol(action, Decl(keyofAndIndexedAccess2.ts, 161, 10)) ->x : Symbol(x, Decl(keyofAndIndexedAccess2.ts, 162, 19)) ->y : Symbol(y, Decl(keyofAndIndexedAccess2.ts, 162, 21)) +>action : Symbol(action, Decl(keyofAndIndexedAccess2.ts, 176, 10)) +>x : Symbol(x, Decl(keyofAndIndexedAccess2.ts, 177, 19)) +>y : Symbol(y, Decl(keyofAndIndexedAccess2.ts, 177, 21)) window[action](x, y); >window : Symbol(window, Decl(lib.dom.d.ts, --, --)) ->action : Symbol(action, Decl(keyofAndIndexedAccess2.ts, 161, 10)) ->x : Symbol(x, Decl(keyofAndIndexedAccess2.ts, 162, 19)) ->y : Symbol(y, Decl(keyofAndIndexedAccess2.ts, 162, 21)) +>action : Symbol(action, Decl(keyofAndIndexedAccess2.ts, 176, 10)) +>x : Symbol(x, Decl(keyofAndIndexedAccess2.ts, 177, 19)) +>y : Symbol(y, Decl(keyofAndIndexedAccess2.ts, 177, 21)) } }