You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), t => getSimplifiedType(t, writing));
17637
17644
}
17638
17645
}
@@ -20263,7 +20270,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
20263
20270
getObjectFlags(type) & ObjectFlags.Reference ? (type as TypeReference).node ? createTypeReference((type as TypeReference).target, getTypeArguments(type as TypeReference)) : getSingleBaseForNonAugmentingSubtype(type) || type :
20264
20271
type.flags & TypeFlags.UnionOrIntersection ? getNormalizedUnionOrIntersectionType(type as UnionOrIntersectionType, writing) :
20265
20272
type.flags & TypeFlags.Substitution ? writing ? (type as SubstitutionType).baseType : getSubstitutionIntersection(type as SubstitutionType) :
Copy file name to clipboardExpand all lines: tests/baselines/reference/conditionalTypes1.errors.txt
+26-34Lines changed: 26 additions & 34 deletions
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ conditionalTypes1.ts(17,5): error TS2322: Type 'T' is not assignable to type 'No
8
8
Type 'T' is not assignable to type '{}'.
9
9
Type 'string | undefined' is not assignable to type '{}'.
10
10
Type 'undefined' is not assignable to type '{}'.
11
-
conditionalTypes1.ts(24,5): error TS2322: Type 'T[keyof T] | undefined' is not assignable to type 'NonNullable<Partial<T>[keyof T]>'.
11
+
conditionalTypes1.ts(24,5): error TS2322: Type 'T[keyof T & string] | T[keyof T & number] | T[keyof T & symbol] | undefined' is not assignable to type 'NonNullable<Partial<T>[keyof T]>'.
12
12
Type 'undefined' is not assignable to type 'T[keyof T] & {}'.
13
13
Type 'undefined' is not assignable to type 'T[keyof T]'.
14
14
'T[keyof T]' could be instantiated with an arbitrary type which could be unrelated to 'undefined'.
@@ -25,32 +25,28 @@ conditionalTypes1.ts(104,5): error TS2322: Type 'NonFunctionProperties<T>' is no
25
25
'T' could be instantiated with an arbitrary type which could be unrelated to 'NonFunctionProperties<T>'.
26
26
conditionalTypes1.ts(106,5): error TS2322: Type 'NonFunctionProperties<T>' is not assignable to type 'FunctionProperties<T>'.
27
27
Type 'FunctionPropertyNames<T>' is not assignable to type 'NonFunctionPropertyNames<T>'.
28
-
Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
29
-
Type 'string | number | symbol' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
30
-
Type 'string' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
31
-
Type 'keyof T' is not assignable to type 'never'.
32
-
Type 'string | number | symbol' is not assignable to type 'never'.
33
-
Type 'string' is not assignable to type 'never'.
28
+
Type 'T[keyof T & string] extends Function ? keyof T & string : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
29
+
Type 'keyof T & string' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
30
+
Type 'keyof T & string' is not assignable to type 'never'.
34
31
conditionalTypes1.ts(108,5): error TS2322: Type 'FunctionProperties<T>' is not assignable to type 'NonFunctionProperties<T>'.
35
32
Type 'NonFunctionPropertyNames<T>' is not assignable to type 'FunctionPropertyNames<T>'.
36
-
Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
37
-
Type 'string | number | symbol' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
38
-
Type 'string' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
39
-
Type 'keyof T' is not assignable to type 'never'.
33
+
Type 'T[keyof T & string] extends Function ? never : keyof T & string' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
34
+
Type 'keyof T & string' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
35
+
Type 'keyof T & string' is not assignable to type 'never'.
40
36
conditionalTypes1.ts(114,5): error TS2322: Type 'keyof T' is not assignable to type 'FunctionPropertyNames<T>'.
41
37
Type 'string | number | symbol' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
42
38
Type 'string' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
43
39
conditionalTypes1.ts(115,5): error TS2322: Type 'NonFunctionPropertyNames<T>' is not assignable to type 'FunctionPropertyNames<T>'.
44
-
Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
45
-
Type 'keyof T' is not assignable to type 'never'.
46
-
Type 'string | number | symbol' is not assignable to type 'never'.
47
-
Type 'string' is not assignable to type 'never'.
40
+
Type 'T[keyof T & string] extends Function ? never : keyof T & string' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
41
+
Type 'keyof T & string' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
42
+
Type 'keyof T & string' is not assignable to type 'never'.
48
43
conditionalTypes1.ts(116,5): error TS2322: Type 'keyof T' is not assignable to type 'NonFunctionPropertyNames<T>'.
49
44
Type 'string | number | symbol' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
50
45
Type 'string' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
51
46
conditionalTypes1.ts(117,5): error TS2322: Type 'FunctionPropertyNames<T>' is not assignable to type 'NonFunctionPropertyNames<T>'.
52
-
Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
53
-
Type 'keyof T' is not assignable to type 'never'.
47
+
Type 'T[keyof T & string] extends Function ? keyof T & string : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
48
+
Type 'keyof T & string' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
49
+
Type 'keyof T & string' is not assignable to type 'never'.
54
50
conditionalTypes1.ts(134,10): error TS2540: Cannot assign to 'id' because it is a read-only property.
55
51
conditionalTypes1.ts(135,5): error TS2542: Index signature in type 'DeepReadonlyArray<Part>' only permits reading.
56
52
conditionalTypes1.ts(136,22): error TS2540: Cannot assign to 'id' because it is a read-only property.
@@ -108,7 +104,7 @@ conditionalTypes1.ts(288,43): error TS2322: Type 'T95<U>' is not assignable to t
108
104
x = y;
109
105
y = x; // Error
110
106
~
111
-
!!! error TS2322: Type 'T[keyof T] | undefined' is not assignable to type 'NonNullable<Partial<T>[keyof T]>'.
107
+
!!! error TS2322: Type 'T[keyof T & string] | T[keyof T & number] | T[keyof T & symbol] | undefined' is not assignable to type 'NonNullable<Partial<T>[keyof T]>'.
112
108
!!! error TS2322: Type 'undefined' is not assignable to type 'T[keyof T] & {}'.
113
109
!!! error TS2322: Type 'undefined' is not assignable to type 'T[keyof T]'.
114
110
!!! error TS2322: 'T[keyof T]' could be instantiated with an arbitrary type which could be unrelated to 'undefined'.
@@ -211,21 +207,17 @@ conditionalTypes1.ts(288,43): error TS2322: Type 'T95<U>' is not assignable to t
211
207
~
212
208
!!! error TS2322: Type 'NonFunctionProperties<T>' is not assignable to type 'FunctionProperties<T>'.
213
209
!!! error TS2322: Type 'FunctionPropertyNames<T>' is not assignable to type 'NonFunctionPropertyNames<T>'.
214
-
!!! error TS2322: Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
215
-
!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
216
-
!!! error TS2322: Type 'string' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
217
-
!!! error TS2322: Type 'keyof T' is not assignable to type 'never'.
218
-
!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'never'.
219
-
!!! error TS2322: Type 'string' is not assignable to type 'never'.
210
+
!!! error TS2322: Type 'T[keyof T & string] extends Function ? keyof T & string : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
211
+
!!! error TS2322: Type 'keyof T & string' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
212
+
!!! error TS2322: Type 'keyof T & string' is not assignable to type 'never'.
220
213
z = x;
221
214
z = y; // Error
222
215
~
223
216
!!! error TS2322: Type 'FunctionProperties<T>' is not assignable to type 'NonFunctionProperties<T>'.
224
217
!!! error TS2322: Type 'NonFunctionPropertyNames<T>' is not assignable to type 'FunctionPropertyNames<T>'.
225
-
!!! error TS2322: Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
226
-
!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
227
-
!!! error TS2322: Type 'string' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
228
-
!!! error TS2322: Type 'keyof T' is not assignable to type 'never'.
218
+
!!! error TS2322: Type 'T[keyof T & string] extends Function ? never : keyof T & string' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
219
+
!!! error TS2322: Type 'keyof T & string' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
220
+
!!! error TS2322: Type 'keyof T & string' is not assignable to type 'never'.
229
221
}
230
222
231
223
function f8<T>(x: keyof T, y: FunctionPropertyNames<T>, z: NonFunctionPropertyNames<T>) {
@@ -239,10 +231,9 @@ conditionalTypes1.ts(288,43): error TS2322: Type 'T95<U>' is not assignable to t
239
231
y = z; // Error
240
232
~
241
233
!!! error TS2322: Type 'NonFunctionPropertyNames<T>' is not assignable to type 'FunctionPropertyNames<T>'.
242
-
!!! error TS2322: Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
243
-
!!! error TS2322: Type 'keyof T' is not assignable to type 'never'.
244
-
!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'never'.
245
-
!!! error TS2322: Type 'string' is not assignable to type 'never'.
234
+
!!! error TS2322: Type 'T[keyof T & string] extends Function ? never : keyof T & string' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
235
+
!!! error TS2322: Type 'keyof T & string' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
236
+
!!! error TS2322: Type 'keyof T & string' is not assignable to type 'never'.
246
237
z = x; // Error
247
238
~
248
239
!!! error TS2322: Type 'keyof T' is not assignable to type 'NonFunctionPropertyNames<T>'.
@@ -251,8 +242,9 @@ conditionalTypes1.ts(288,43): error TS2322: Type 'T95<U>' is not assignable to t
251
242
z = y; // Error
252
243
~
253
244
!!! error TS2322: Type 'FunctionPropertyNames<T>' is not assignable to type 'NonFunctionPropertyNames<T>'.
254
-
!!! error TS2322: Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
255
-
!!! error TS2322: Type 'keyof T' is not assignable to type 'never'.
245
+
!!! error TS2322: Type 'T[keyof T & string] extends Function ? keyof T & string : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
246
+
!!! error TS2322: Type 'keyof T & string' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
247
+
!!! error TS2322: Type 'keyof T & string' is not assignable to type 'never'.
0 commit comments