Skip to content

Commit 66f8a40

Browse files
committed
Update tests
1 parent d7dd028 commit 66f8a40

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

tests/cases/conformance/types/mapped/mappedTypes1.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ type T47 = { [P in string | "a" | "b" | "0" | "1"]: void };
3434
declare function f1<T1>(): { [P in keyof T1]: void };
3535
declare function f2<T1 extends string>(): { [P in keyof T1]: void };
3636
declare function f3<T1 extends number>(): { [P in keyof T1]: void };
37+
declare function f4<T1 extends Number>(): { [P in keyof T1]: void };
3738

3839
let x1 = f1();
3940
let x2 = f2();
40-
let x3 = f3();
41+
let x3 = f3();
42+
let x4 = f4();

tests/cases/conformance/types/mapped/mappedTypes2.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,30 @@ declare function pick<T, K extends keyof T>(obj: T, ...keys: K[]): Pick<T, K>;
3131
declare function mapObject<K extends string, T, U>(obj: Record<K, T>, f: (x: T) => U): Record<K, U>;
3232
declare function proxify<T>(obj: T): Proxify<T>;
3333

34+
interface Point {
35+
x: number;
36+
y: number;
37+
}
38+
3439
interface Shape {
3540
name: string;
3641
width: number;
3742
height: number;
38-
visible: boolean;
43+
location: Point;
3944
}
4045

4146
interface PartialShape {
4247
name?: string;
4348
width?: number;
4449
height?: number;
45-
visible?: boolean;
50+
location?: Point;
4651
}
4752

4853
interface ReadonlyShape {
4954
readonly name: string;
5055
readonly width: number;
5156
readonly height: number;
52-
readonly visible: boolean;
57+
readonly location: Point;
5358
}
5459

5560
function f0(s1: Shape, s2: Shape) {
@@ -70,7 +75,7 @@ function f2(shape: Shape) {
7075
}
7176

7277
function f3(shape: Shape) {
73-
const x = pick(shape, "name", "visible"); // { name: string, visible: boolean }
78+
const x = pick(shape, "name", "location"); // { name: string, location: Point }
7479
}
7580

7681
function f4() {
@@ -81,11 +86,11 @@ function f4() {
8186
function f5(shape: Shape) {
8287
const p = proxify(shape);
8388
let name = p.name.get();
84-
p.visible.set(false);
89+
p.width.set(42);
8590
}
8691

8792
function f6(shape: DeepReadonly<Shape>) {
88-
let name = shape.name; // DeepReadonly<string>
89-
let length = name.length; // DeepReadonly<number>
90-
let toString = length.toString; // DeepReadonly<(radix?: number) => string>
93+
let name = shape.name; // string
94+
let location = shape.location; // DeepReadonly<Point>
95+
let x = location.x; // number
9196
}

0 commit comments

Comments
 (0)