diff --git a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts index 522bfe34e1..690154cb7a 100644 --- a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts +++ b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts @@ -95,22 +95,18 @@ function f10(shape: Shape) { function f11(a: Shape[]) { let len = getProperty(a, "length"); // number - let shape = getProperty(a, 1000); // Shape - setProperty(a, 1000, getProperty(a, 1001)); + setProperty(a, "length", len); } function f12(t: [Shape, boolean]) { let len = getProperty(t, "length"); - let s1 = getProperty(t, 0); // Shape let s2 = getProperty(t, "0"); // Shape - let b1 = getProperty(t, 1); // boolean let b2 = getProperty(t, "1"); // boolean - let x1 = getProperty(t, 2); // Shape | boolean } function f13(foo: any, bar: any) { let x = getProperty(foo, "x"); // any - let y = getProperty(foo, 100); // any + let y = getProperty(foo, "100"); // any let z = getProperty(foo, bar); // any } @@ -181,20 +177,14 @@ function f40(c: C) { let z: Z = c["z"]; } -function f50(k: keyof T, s: string, n: number) { +function f50(k: keyof T, s: string) { const x1 = s as keyof T; - const x2 = n as keyof T; - const x3 = k as string; - const x4 = k as number; - const x5 = k as string | number; + const x2 = k as string; } -function f51(k: K, s: string, n: number) { +function f51(k: K, s: string) { const x1 = s as keyof T; - const x2 = n as keyof T; - const x3 = k as string; - const x4 = k as number; - const x5 = k as string | number; + const x2 = k as string; } function f52(obj: { [x: string]: boolean }, k: keyof T, s: string, n: number) { diff --git a/tests/cases/conformance/types/mapped/mappedTypeErrors.ts b/tests/cases/conformance/types/mapped/mappedTypeErrors.ts index c507bf64a6..b318cde3aa 100644 --- a/tests/cases/conformance/types/mapped/mappedTypeErrors.ts +++ b/tests/cases/conformance/types/mapped/mappedTypeErrors.ts @@ -20,8 +20,9 @@ interface Point { // Constraint checking type T00 = { [P in P]: string }; // Error -type T01 = { [P in Date]: number }; // Error -type T02 = Record; // Error +type T01 = { [P in number]: string }; // Error +type T02 = { [P in Date]: number }; // Error +type T03 = Record; // Error type T10 = Pick; type T11 = Pick; // Error diff --git a/tests/cases/conformance/types/mapped/mappedTypes1.ts b/tests/cases/conformance/types/mapped/mappedTypes1.ts index bfc68aaa59..d090b73151 100644 --- a/tests/cases/conformance/types/mapped/mappedTypes1.ts +++ b/tests/cases/conformance/types/mapped/mappedTypes1.ts @@ -27,13 +27,9 @@ type T37 = { [P in keyof symbol]: void }; type T38 = { [P in keyof never]: void }; type T40 = { [P in string]: void }; -type T41 = { [P in number]: void }; -type T42 = { [P in string | number]: void }; -type T43 = { [P in "a" | "b" | 0 | 1]: void }; +type T43 = { [P in "a" | "b"]: void }; type T44 = { [P in "a" | "b" | "0" | "1"]: void }; -type T45 = { [P in "a" | "b" | "0" | "1" | 0 | 1]: void }; -type T46 = { [P in number | "a" | "b" | 0 | 1]: void }; -type T47 = { [P in string | number | "a" | "b" | 0 | 1]: void }; +type T47 = { [P in string | "a" | "b" | "0" | "1"]: void }; declare function f1(): { [P in keyof T1]: void }; declare function f2(): { [P in keyof T1]: void }; diff --git a/tests/cases/conformance/types/mapped/mappedTypes2.ts b/tests/cases/conformance/types/mapped/mappedTypes2.ts index 7f5841410e..e72a0c0a89 100644 --- a/tests/cases/conformance/types/mapped/mappedTypes2.ts +++ b/tests/cases/conformance/types/mapped/mappedTypes2.ts @@ -28,7 +28,7 @@ type DeepReadonly = { declare function assign(obj: T, props: Partial): void; declare function freeze(obj: T): Readonly; declare function pick(obj: T, ...keys: K[]): Pick; -declare function mapObject(obj: Record, f: (x: T) => U): Record; +declare function mapObject(obj: Record, f: (x: T) => U): Record; declare function proxify(obj: T): Proxify; interface Shape {