File: mappedTypeRelationships.errors.txt

package info (click to toggle)
node-typescript 5.0.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 459,140 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (375 lines) | stat: -rw-r--r-- 21,535 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(11,5): error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T]'.
  Type 'T' is not assignable to type 'U'.
    'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(16,5): error TS2322: Type 'T[K]' is not assignable to type 'U[K]'.
  Type 'T' is not assignable to type 'U'.
    'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(20,5): error TS2536: Type 'keyof U' cannot be used to index type 'T'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(21,12): error TS2536: Type 'keyof U' cannot be used to index type 'T'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(25,5): error TS2536: Type 'K' cannot be used to index type 'T'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(26,12): error TS2536: Type 'K' cannot be used to index type 'T'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(30,5): error TS2322: Type 'T[keyof T] | undefined' is not assignable to type 'T[keyof T]'.
  'T[keyof T]' could be instantiated with an arbitrary type which could be unrelated to 'T[keyof T] | undefined'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(35,5): error TS2322: Type 'T[K] | undefined' is not assignable to type 'T[K]'.
  'T[K]' could be instantiated with an arbitrary type which could be unrelated to 'T[K] | undefined'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(40,5): error TS2322: Type 'U[keyof T] | undefined' is not assignable to type 'T[keyof T]'.
  'T[keyof T]' could be instantiated with an arbitrary type which could be unrelated to 'U[keyof T] | undefined'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(41,5): error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T] | undefined'.
  Type 'T[string] | T[number] | T[symbol]' is not assignable to type 'U[keyof T] | undefined'.
    Type 'T[string]' is not assignable to type 'U[keyof T] | undefined'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(45,5): error TS2322: Type 'U[K] | undefined' is not assignable to type 'T[K]'.
  'T[K]' could be instantiated with an arbitrary type which could be unrelated to 'U[K] | undefined'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(46,5): error TS2322: Type 'T[K]' is not assignable to type 'U[K] | undefined'.
  Type 'T[keyof T]' is not assignable to type 'U[K] | undefined'.
    Type 'T[string] | T[number] | T[symbol]' is not assignable to type 'U[K] | undefined'.
      Type 'T[string]' is not assignable to type 'U[K] | undefined'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(51,5): error TS2542: Index signature in type 'Readonly<T>' only permits reading.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(56,5): error TS2542: Index signature in type 'Readonly<T>' only permits reading.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(61,5): error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T]'.
  Type 'T' is not assignable to type 'U'.
    'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(61,5): error TS2542: Index signature in type 'Readonly<U>' only permits reading.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(66,5): error TS2322: Type 'T[K]' is not assignable to type 'U[K]'.
  Type 'T' is not assignable to type 'U'.
    'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(66,5): error TS2542: Index signature in type 'Readonly<U>' only permits reading.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(72,5): error TS2322: Type 'Partial<T>' is not assignable to type 'T'.
  'T' could be instantiated with an arbitrary type which could be unrelated to 'Partial<T>'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(78,5): error TS2322: Type 'Partial<Thing>' is not assignable to type 'Partial<T>'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(88,5): error TS2322: Type 'Readonly<Thing>' is not assignable to type 'Readonly<T>'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(127,5): error TS2322: Type 'Partial<U>' is not assignable to type 'Identity<U>'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(143,5): error TS2322: Type '{ [P in keyof T]: T[P]; }' is not assignable to type '{ [P in keyof T]: U[P]; }'.
  Type 'T[P]' is not assignable to type 'U[P]'.
    Type 'T' is not assignable to type 'U'.
      'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(148,5): error TS2322: Type '{ [P in keyof T]: T[P]; }' is not assignable to type '{ [P in keyof U]: U[P]; }'.
  Type 'keyof U' is not assignable to type 'keyof T'.
    Type 'string | number | symbol' is not assignable to type 'keyof T'.
      Type 'string' is not assignable to type 'keyof T'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(153,5): error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof T]: T[P]; }'.
  Type 'keyof T' is not assignable to type 'K'.
    'keyof T' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'.
      Type 'string | number | symbol' is not assignable to type 'K'.
        'string | number | symbol' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'.
          Type 'string' is not assignable to type 'K'.
            'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(158,5): error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof U]: U[P]; }'.
  Type 'keyof U' is not assignable to type 'K'.
    'keyof U' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'.
      Type 'string | number | symbol' is not assignable to type 'K'.
        'string | number | symbol' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'.
          Type 'string' is not assignable to type 'K'.
            'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(163,5): error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof T]: U[P]; }'.
  Type 'keyof T' is not assignable to type 'K'.
    'keyof T' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'.
      Type 'string | number | symbol' is not assignable to type 'K'.
        'string | number | symbol' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'.
          Type 'string' is not assignable to type 'K'.
            'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in K]: U[P]; }'.
  Type 'T[P]' is not assignable to type 'U[P]'.
    Type 'T' is not assignable to type 'U'.
      'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.


==== tests/cases/conformance/types/mapped/mappedTypeRelationships.ts (28 errors) ====
    function f1<T>(x: T, k: keyof T) {
        return x[k];
    }
    
    function f2<T, K extends keyof T>(x: T, k: K) {
        return x[k];
    }
    
    function f3<T, U extends T>(x: T, y: U, k: keyof T) {
        x[k] = y[k];
        y[k] = x[k];  // Error
        ~~~~
!!! error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T]'.
!!! error TS2322:   Type 'T' is not assignable to type 'U'.
!!! error TS2322:     'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
!!! related TS2208 tests/cases/conformance/types/mapped/mappedTypeRelationships.ts:9:13: This type parameter might need an `extends U` constraint.
    }
    
    function f4<T, U extends T, K extends keyof T>(x: T, y: U, k: K) {
        x[k] = y[k];
        y[k] = x[k];  // Error
        ~~~~
!!! error TS2322: Type 'T[K]' is not assignable to type 'U[K]'.
!!! error TS2322:   Type 'T' is not assignable to type 'U'.
!!! error TS2322:     'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
!!! related TS2208 tests/cases/conformance/types/mapped/mappedTypeRelationships.ts:14:13: This type parameter might need an `extends U` constraint.
    }
    
    function f5<T, U extends T>(x: T, y: U, k: keyof U) {
        x[k] = y[k];  // Error
        ~~~~
!!! error TS2536: Type 'keyof U' cannot be used to index type 'T'.
        y[k] = x[k];  // Error
               ~~~~
!!! error TS2536: Type 'keyof U' cannot be used to index type 'T'.
    }
    
    function f6<T, U extends T, K extends keyof U>(x: T, y: U, k: K) {
        x[k] = y[k];  // Error
        ~~~~
!!! error TS2536: Type 'K' cannot be used to index type 'T'.
        y[k] = x[k];  // Error
               ~~~~
!!! error TS2536: Type 'K' cannot be used to index type 'T'.
    }
    
    function f10<T>(x: T, y: Partial<T>, k: keyof T) {
        x[k] = y[k];  // Error
        ~~~~
!!! error TS2322: Type 'T[keyof T] | undefined' is not assignable to type 'T[keyof T]'.
!!! error TS2322:   'T[keyof T]' could be instantiated with an arbitrary type which could be unrelated to 'T[keyof T] | undefined'.
        y[k] = x[k];
    }
    
    function f11<T, K extends keyof T>(x: T, y: Partial<T>, k: K) {
        x[k] = y[k];  // Error
        ~~~~
!!! error TS2322: Type 'T[K] | undefined' is not assignable to type 'T[K]'.
!!! error TS2322:   'T[K]' could be instantiated with an arbitrary type which could be unrelated to 'T[K] | undefined'.
        y[k] = x[k];
    }
    
    function f12<T, U extends T>(x: T, y: Partial<U>, k: keyof T) {
        x[k] = y[k];  // Error
        ~~~~
!!! error TS2322: Type 'U[keyof T] | undefined' is not assignable to type 'T[keyof T]'.
!!! error TS2322:   'T[keyof T]' could be instantiated with an arbitrary type which could be unrelated to 'U[keyof T] | undefined'.
        y[k] = x[k];  // Error
        ~~~~
!!! error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T] | undefined'.
!!! error TS2322:   Type 'T[string] | T[number] | T[symbol]' is not assignable to type 'U[keyof T] | undefined'.
!!! error TS2322:     Type 'T[string]' is not assignable to type 'U[keyof T] | undefined'.
    }
    
    function f13<T, U extends T, K extends keyof T>(x: T, y: Partial<U>, k: K) {
        x[k] = y[k];  // Error
        ~~~~
!!! error TS2322: Type 'U[K] | undefined' is not assignable to type 'T[K]'.
!!! error TS2322:   'T[K]' could be instantiated with an arbitrary type which could be unrelated to 'U[K] | undefined'.
        y[k] = x[k];  // Error
        ~~~~
!!! error TS2322: Type 'T[K]' is not assignable to type 'U[K] | undefined'.
!!! error TS2322:   Type 'T[keyof T]' is not assignable to type 'U[K] | undefined'.
!!! error TS2322:     Type 'T[string] | T[number] | T[symbol]' is not assignable to type 'U[K] | undefined'.
!!! error TS2322:       Type 'T[string]' is not assignable to type 'U[K] | undefined'.
    }
    
    function f20<T>(x: T, y: Readonly<T>, k: keyof T) {
        x[k] = y[k];
        y[k] = x[k];  // Error
        ~~~~
!!! error TS2542: Index signature in type 'Readonly<T>' only permits reading.
    }
    
    function f21<T, K extends keyof T>(x: T, y: Readonly<T>, k: K) {
        x[k] = y[k];
        y[k] = x[k];  // Error
        ~~~~
!!! error TS2542: Index signature in type 'Readonly<T>' only permits reading.
    }
    
    function f22<T, U extends T>(x: T, y: Readonly<U>, k: keyof T) {
        x[k] = y[k];
        y[k] = x[k];  // Error
        ~~~~
!!! error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T]'.
!!! error TS2322:   Type 'T' is not assignable to type 'U'.
!!! error TS2322:     'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
!!! related TS2208 tests/cases/conformance/types/mapped/mappedTypeRelationships.ts:59:14: This type parameter might need an `extends U` constraint.
        ~~~~
!!! error TS2542: Index signature in type 'Readonly<U>' only permits reading.
    }
    
    function f23<T, U extends T, K extends keyof T>(x: T, y: Readonly<U>, k: K) {
        x[k] = y[k];
        y[k] = x[k];  // Error
        ~~~~
!!! error TS2322: Type 'T[K]' is not assignable to type 'U[K]'.
!!! error TS2322:   Type 'T' is not assignable to type 'U'.
!!! error TS2322:     'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
!!! related TS2208 tests/cases/conformance/types/mapped/mappedTypeRelationships.ts:64:14: This type parameter might need an `extends U` constraint.
        ~~~~
!!! error TS2542: Index signature in type 'Readonly<U>' only permits reading.
    }
    
    type Thing = { a: string, b: string };
    
    function f30<T>(x: T, y: Partial<T>) {
        x = y;  // Error
        ~
!!! error TS2322: Type 'Partial<T>' is not assignable to type 'T'.
!!! error TS2322:   'T' could be instantiated with an arbitrary type which could be unrelated to 'Partial<T>'.
        y = x;
    }
    
    function f31<T extends Thing>(x: Partial<Thing>, y: Partial<T>) {
        x = y;
        y = x;  // Error
        ~
!!! error TS2322: Type 'Partial<Thing>' is not assignable to type 'Partial<T>'.
    }
    
    function f40<T>(x: T, y: Readonly<T>) {
        x = y;
        y = x;
    }
    
    function f41<T extends Thing>(x: Readonly<Thing>, y: Readonly<T>) {
        x = y;
        y = x;  // Error
        ~
!!! error TS2322: Type 'Readonly<Thing>' is not assignable to type 'Readonly<T>'.
    }
    
    type Item = {
        name: string;
    }
    
    type ItemMap = {
        [x: string]: Item;
    }
    
    function f50<T extends ItemMap>(obj: T, key: keyof T) {
        let item: Item = obj[key];
        return obj[key].name;
    }
    
    function f51<T extends ItemMap, K extends keyof T>(obj: T, key: K) {
        let item: Item = obj[key];
        return obj[key].name;
    }
    
    type T1<T> = {
        [P in keyof T]: T[P];
    }
    
    type T2<T> = {
        [P in keyof T]: T[P];
    }
    
    function f60<U>(x: T1<U>, y: T2<U>) {
        x = y;
        y = x;
    }
    
    type Identity<T> = {
        [P in keyof T]: T[P];
    }
    
    function f61<U>(x: Identity<U>, y: Partial<U>) {
        x = y;  // Error
        ~
!!! error TS2322: Type 'Partial<U>' is not assignable to type 'Identity<U>'.
        y = x;
    }
    
    function f62<U>(x: Identity<U>, y: Readonly<U>) {
        x = y;
        y = x;
    }
    
    function f70<T>(x: { [P in keyof T]: T[P] }, y: { [P in keyof T]: T[P] }) {
        x = y;
        y = x;
    }
    
    function f71<T, U extends T>(x: { [P in keyof T]: T[P] }, y: { [P in keyof T]: U[P] }) {
        x = y;
        y = x;  // Error
        ~
!!! error TS2322: Type '{ [P in keyof T]: T[P]; }' is not assignable to type '{ [P in keyof T]: U[P]; }'.
!!! error TS2322:   Type 'T[P]' is not assignable to type 'U[P]'.
!!! error TS2322:     Type 'T' is not assignable to type 'U'.
!!! error TS2322:       'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
!!! related TS2208 tests/cases/conformance/types/mapped/mappedTypeRelationships.ts:141:14: This type parameter might need an `extends U` constraint.
    }
    
    function f72<T, U extends T>(x: { [P in keyof T]: T[P] }, y: { [P in keyof U]: U[P] }) {
        x = y;
        y = x;  // Error
        ~
!!! error TS2322: Type '{ [P in keyof T]: T[P]; }' is not assignable to type '{ [P in keyof U]: U[P]; }'.
!!! error TS2322:   Type 'keyof U' is not assignable to type 'keyof T'.
!!! error TS2322:     Type 'string | number | symbol' is not assignable to type 'keyof T'.
!!! error TS2322:       Type 'string' is not assignable to type 'keyof T'.
    }
    
    function f73<T, K extends keyof T>(x: { [P in K]: T[P] }, y: { [P in keyof T]: T[P] }) {
        x = y;
        y = x;  // Error
        ~
!!! error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof T]: T[P]; }'.
!!! error TS2322:   Type 'keyof T' is not assignable to type 'K'.
!!! error TS2322:     'keyof T' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'.
!!! error TS2322:       Type 'string | number | symbol' is not assignable to type 'K'.
!!! error TS2322:         'string | number | symbol' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'.
!!! error TS2322:           Type 'string' is not assignable to type 'K'.
!!! error TS2322:             'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'.
    }
    
    function f74<T, U extends T, K extends keyof T>(x: { [P in K]: T[P] }, y: { [P in keyof U]: U[P] }) {
        x = y;
        y = x;  // Error
        ~
!!! error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof U]: U[P]; }'.
!!! error TS2322:   Type 'keyof U' is not assignable to type 'K'.
!!! error TS2322:     'keyof U' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'.
!!! error TS2322:       Type 'string | number | symbol' is not assignable to type 'K'.
!!! error TS2322:         'string | number | symbol' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'.
!!! error TS2322:           Type 'string' is not assignable to type 'K'.
!!! error TS2322:             'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'.
    }
    
    function f75<T, U extends T, K extends keyof T>(x: { [P in K]: T[P] }, y: { [P in keyof T]: U[P] }) {
        x = y;
        y = x;  // Error
        ~
!!! error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof T]: U[P]; }'.
!!! error TS2322:   Type 'keyof T' is not assignable to type 'K'.
!!! error TS2322:     'keyof T' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'.
!!! error TS2322:       Type 'string | number | symbol' is not assignable to type 'K'.
!!! error TS2322:         'string | number | symbol' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'.
!!! error TS2322:           Type 'string' is not assignable to type 'K'.
!!! error TS2322:             'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'.
    }
    
    function f76<T, U extends T, K extends keyof T>(x: { [P in K]: T[P] }, y: { [P in K]: U[P] }) {
        x = y;
        y = x;  // Error
        ~
!!! error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in K]: U[P]; }'.
!!! error TS2322:   Type 'T[P]' is not assignable to type 'U[P]'.
!!! error TS2322:     Type 'T' is not assignable to type 'U'.
!!! error TS2322:       'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
!!! related TS2208 tests/cases/conformance/types/mapped/mappedTypeRelationships.ts:166:14: This type parameter might need an `extends U` constraint.
    }
    
    function f80<T>(t: T): Partial<T> {
        return t;
    }
    
    function f81<T, K extends keyof T>(t: T, k: K): Partial<T[K]> {
        return t[k];
    }
    
    function f82<T, K1 extends keyof T, K2 extends keyof T[K1]>(t: T, k1: K1, k2: K2): Partial<T[K1][K2]> {
        return t[k1][k2];
    }
    
    // #31070
    type Numeric<T> = { [K in keyof T]?: number };
    function f90<T extends { x: number }>() {
        const n: Numeric<T> = { x: 1 };
    }
    
    function f<T extends { x: {} }>(): Partial<T> {
        return undefined! as T;
    }