@@ -31,25 +31,30 @@ declare function pick<T, K extends keyof T>(obj: T, ...keys: K[]): Pick<T, K>;
31
31
declare function mapObject < K extends string , T , U > ( obj : Record < K , T > , f : ( x : T ) => U ) : Record < K , U > ;
32
32
declare function proxify < T > ( obj : T ) : Proxify < T > ;
33
33
34
+ interface Point {
35
+ x : number ;
36
+ y : number ;
37
+ }
38
+
34
39
interface Shape {
35
40
name : string ;
36
41
width : number ;
37
42
height : number ;
38
- visible : boolean ;
43
+ location : Point ;
39
44
}
40
45
41
46
interface PartialShape {
42
47
name ?: string ;
43
48
width ?: number ;
44
49
height ?: number ;
45
- visible ?: boolean ;
50
+ location ?: Point ;
46
51
}
47
52
48
53
interface ReadonlyShape {
49
54
readonly name : string ;
50
55
readonly width : number ;
51
56
readonly height : number ;
52
- readonly visible : boolean ;
57
+ readonly location : Point ;
53
58
}
54
59
55
60
function f0 ( s1 : Shape , s2 : Shape ) {
@@ -70,7 +75,7 @@ function f2(shape: Shape) {
70
75
}
71
76
72
77
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 }
74
79
}
75
80
76
81
function f4 ( ) {
@@ -81,11 +86,11 @@ function f4() {
81
86
function f5 ( shape : Shape ) {
82
87
const p = proxify ( shape ) ;
83
88
let name = p . name . get ( ) ;
84
- p . visible . set ( false ) ;
89
+ p . width . set ( 42 ) ;
85
90
}
86
91
87
92
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
91
96
}
0 commit comments