Skip to content

Commit df3766d

Browse files
Accepted baselines.
1 parent 21fde45 commit df3766d

21 files changed

+138
-131
lines changed

tests/baselines/reference/conditionalTypeDoesntSpinForever.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ export enum PubSubRecordIsStoredInRedisAsA {
413413
>Object.keys : { (o: object): string[]; (o: {}): string[]; }
414414
>Object : ObjectConstructor
415415
>keys : { (o: object): string[]; (o: {}): string[]; }
416-
>soFar : SO_FAR
416+
>soFar : unknown
417417

418418
hasField: (fieldName: string | number | symbol) => fieldName in soFar
419419
>hasField : (fieldName: string | number | symbol) => boolean
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
tests/cases/conformance/types/conditional/conditionalTypesExcessProperties.ts(8,5): error TS2322: Type '{ test: string; arg: A; }' is not assignable to type 'Something<A>'.
2-
Type '{ test: string; arg: A; }' is not assignable to type 'A extends object ? { arg: A; } : { arg?: undefined; }'.
3-
tests/cases/conformance/types/conditional/conditionalTypesExcessProperties.ts(9,5): error TS2322: Type '{ test: string; arg: A; arr: A; }' is not assignable to type 'Something<A>'.
4-
Type '{ test: string; arg: A; arr: A; }' is not assignable to type 'A extends object ? { arg: A; } : { arg?: undefined; }'.
1+
tests/cases/conformance/types/conditional/conditionalTypesExcessProperties.ts(8,5): error TS2322: Type '{ test: string; arg: object; }' is not assignable to type 'Something<A>'.
2+
Type '{ test: string; arg: object; }' is not assignable to type 'A extends object ? { arg: A; } : { arg?: undefined; }'.
3+
tests/cases/conformance/types/conditional/conditionalTypesExcessProperties.ts(9,5): error TS2322: Type '{ test: string; arg: object; arr: A; }' is not assignable to type 'Something<A>'.
4+
Type '{ test: string; arg: object; arr: A; }' is not assignable to type 'A extends object ? { arg: A; } : { arg?: undefined; }'.
55

66

77
==== tests/cases/conformance/types/conditional/conditionalTypesExcessProperties.ts (2 errors) ====
@@ -14,11 +14,11 @@ tests/cases/conformance/types/conditional/conditionalTypesExcessProperties.ts(9,
1414
function testFunc2<A extends object>(a: A, sa: Something<A>) {
1515
sa = { test: 'hi', arg: a }; // not excess (but currently still not assignable)
1616
~~
17-
!!! error TS2322: Type '{ test: string; arg: A; }' is not assignable to type 'Something<A>'.
18-
!!! error TS2322: Type '{ test: string; arg: A; }' is not assignable to type 'A extends object ? { arg: A; } : { arg?: undefined; }'.
17+
!!! error TS2322: Type '{ test: string; arg: object; }' is not assignable to type 'Something<A>'.
18+
!!! error TS2322: Type '{ test: string; arg: object; }' is not assignable to type 'A extends object ? { arg: A; } : { arg?: undefined; }'.
1919
sa = { test: 'bye', arg: a, arr: a } // excess
2020
~~
21-
!!! error TS2322: Type '{ test: string; arg: A; arr: A; }' is not assignable to type 'Something<A>'.
22-
!!! error TS2322: Type '{ test: string; arg: A; arr: A; }' is not assignable to type 'A extends object ? { arg: A; } : { arg?: undefined; }'.
21+
!!! error TS2322: Type '{ test: string; arg: object; arr: A; }' is not assignable to type 'Something<A>'.
22+
!!! error TS2322: Type '{ test: string; arg: object; arr: A; }' is not assignable to type 'A extends object ? { arg: A; } : { arg?: undefined; }'.
2323
}
2424

tests/baselines/reference/conditionalTypesExcessProperties.types

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,22 @@ function testFunc2<A extends object>(a: A, sa: Something<A>) {
1818
>sa : Something<A>
1919

2020
sa = { test: 'hi', arg: a }; // not excess (but currently still not assignable)
21-
>sa = { test: 'hi', arg: a } : { test: string; arg: A; }
21+
>sa = { test: 'hi', arg: a } : { test: string; arg: object; }
2222
>sa : Something<A>
23-
>{ test: 'hi', arg: a } : { test: string; arg: A; }
23+
>{ test: 'hi', arg: a } : { test: string; arg: object; }
2424
>test : string
2525
>'hi' : "hi"
26-
>arg : A
27-
>a : A
26+
>arg : object
27+
>a : object
2828

2929
sa = { test: 'bye', arg: a, arr: a } // excess
30-
>sa = { test: 'bye', arg: a, arr: a } : { test: string; arg: A; arr: A; }
30+
>sa = { test: 'bye', arg: a, arr: a } : { test: string; arg: object; arr: A; }
3131
>sa : Something<A>
32-
>{ test: 'bye', arg: a, arr: a } : { test: string; arg: A; arr: A; }
32+
>{ test: 'bye', arg: a, arr: a } : { test: string; arg: object; arr: A; }
3333
>test : string
3434
>'bye' : "bye"
35-
>arg : A
36-
>a : A
35+
>arg : object
36+
>a : object
3737
>arr : A
3838
>a : A
3939
}

tests/baselines/reference/constructorReturningAPrimitive.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class B<T> {
2424
>x : T
2525

2626
return x;
27-
>x : T
27+
>x : unknown
2828
}
2929
}
3030

tests/baselines/reference/contextualNarrowingFromUnknownToObjects(strictnullchecks=false).types

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ namespace implicitConstraints {
5656
>keysOfEmptyObject(a).length : number
5757
>keysOfEmptyObject(a) : string[]
5858
>keysOfEmptyObject : (o: {}) => string[]
59-
>a : T
59+
>a : object
6060
>length : number
6161
>keysOfEmptyObject(b).length : number
6262
>keysOfEmptyObject(b) : string[]
6363
>keysOfEmptyObject : (o: {}) => string[]
64-
>b : T
64+
>b : object
6565
>length : number
6666

6767
return [a, b];
@@ -119,12 +119,12 @@ namespace implicitConstraints {
119119
>keysOfNonPrimitive(a).length : number
120120
>keysOfNonPrimitive(a) : string[]
121121
>keysOfNonPrimitive : (o: object) => string[]
122-
>a : T
122+
>a : object
123123
>length : number
124124
>keysOfNonPrimitive(b).length : number
125125
>keysOfNonPrimitive(b) : string[]
126126
>keysOfNonPrimitive : (o: object) => string[]
127-
>b : T
127+
>b : object
128128
>length : number
129129

130130
return [a, b];
@@ -187,12 +187,12 @@ namespace explicitConstraintsOfUnknown {
187187
>keysOfEmptyObject(a).length : number
188188
>keysOfEmptyObject(a) : string[]
189189
>keysOfEmptyObject : (o: {}) => string[]
190-
>a : T
190+
>a : object
191191
>length : number
192192
>keysOfEmptyObject(b).length : number
193193
>keysOfEmptyObject(b) : string[]
194194
>keysOfEmptyObject : (o: {}) => string[]
195-
>b : T
195+
>b : object
196196
>length : number
197197

198198
return [a, b];
@@ -250,12 +250,12 @@ namespace explicitConstraintsOfUnknown {
250250
>keysOfNonPrimitive(a).length : number
251251
>keysOfNonPrimitive(a) : string[]
252252
>keysOfNonPrimitive : (o: object) => string[]
253-
>a : T
253+
>a : object
254254
>length : number
255255
>keysOfNonPrimitive(b).length : number
256256
>keysOfNonPrimitive(b) : string[]
257257
>keysOfNonPrimitive : (o: object) => string[]
258-
>b : T
258+
>b : object
259259
>length : number
260260

261261
return [a, b];

tests/baselines/reference/contextualNarrowingFromUnknownToObjects(strictnullchecks=true).types

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ namespace implicitConstraints {
5656
>keysOfEmptyObject(a).length : number
5757
>keysOfEmptyObject(a) : string[]
5858
>keysOfEmptyObject : (o: {}) => string[]
59-
>a : T
59+
>a : object
6060
>length : number
6161
>keysOfEmptyObject(b).length : number
6262
>keysOfEmptyObject(b) : string[]
6363
>keysOfEmptyObject : (o: {}) => string[]
64-
>b : T
64+
>b : object
6565
>length : number
6666

6767
return [a, b];
@@ -119,12 +119,12 @@ namespace implicitConstraints {
119119
>keysOfNonPrimitive(a).length : number
120120
>keysOfNonPrimitive(a) : string[]
121121
>keysOfNonPrimitive : (o: object) => string[]
122-
>a : T
122+
>a : object
123123
>length : number
124124
>keysOfNonPrimitive(b).length : number
125125
>keysOfNonPrimitive(b) : string[]
126126
>keysOfNonPrimitive : (o: object) => string[]
127-
>b : T
127+
>b : object
128128
>length : number
129129

130130
return [a, b];
@@ -187,12 +187,12 @@ namespace explicitConstraintsOfUnknown {
187187
>keysOfEmptyObject(a).length : number
188188
>keysOfEmptyObject(a) : string[]
189189
>keysOfEmptyObject : (o: {}) => string[]
190-
>a : T
190+
>a : object
191191
>length : number
192192
>keysOfEmptyObject(b).length : number
193193
>keysOfEmptyObject(b) : string[]
194194
>keysOfEmptyObject : (o: {}) => string[]
195-
>b : T
195+
>b : object
196196
>length : number
197197

198198
return [a, b];
@@ -250,12 +250,12 @@ namespace explicitConstraintsOfUnknown {
250250
>keysOfNonPrimitive(a).length : number
251251
>keysOfNonPrimitive(a) : string[]
252252
>keysOfNonPrimitive : (o: object) => string[]
253-
>a : T
253+
>a : object
254254
>length : number
255255
>keysOfNonPrimitive(b).length : number
256256
>keysOfNonPrimitive(b) : string[]
257257
>keysOfNonPrimitive : (o: object) => string[]
258-
>b : T
258+
>b : object
259259
>length : number
260260

261261
return [a, b];
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
tests/cases/compiler/crashInGetTextOfComputedPropertyName.ts(23,24): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
2+
3+
4+
==== tests/cases/compiler/crashInGetTextOfComputedPropertyName.ts (1 errors) ====
5+
// https://github.com/Microsoft/TypeScript/issues/29006
6+
export interface A { type: 'a' }
7+
export interface B { type: 'b' }
8+
export type AB = A | B
9+
10+
const itemId = 'some-id'
11+
12+
// --- test on first level ---
13+
const items: { [id: string]: AB } = {}
14+
const { [itemId]: itemOk1 } = items
15+
typeof itemOk1 // pass
16+
17+
// --- test on second level ---
18+
interface ObjWithItems {
19+
items: {[s: string]: AB}
20+
}
21+
const objWithItems: ObjWithItems = { items: {}}
22+
23+
const itemOk2 = objWithItems.items[itemId]
24+
typeof itemOk2 // pass
25+
26+
const {
27+
items: { [itemId]: itemWithTSError } = {} /*happens when default value is provided*/
28+
~~~~~~~~~~~~~~~
29+
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
30+
} = objWithItems
31+
32+
// in order to re-produce the error, uncomment next line:
33+
typeof itemWithTSError // :(
34+
35+
// will result in:
36+
// Error from compilation: TypeError: Cannot read property 'charCodeAt' of undefined TypeError: Cannot read property 'charCodeAt' of undefined

tests/baselines/reference/esNextWeakRefs_IterableWeakMap.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export class IterableWeakMap<K extends object, V> implements WeakMap<K, V> {
134134
>this.#finalizationGroup : FinalizationRegistry<{ readonly ref: WeakRef<object>; readonly set: Set<WeakRef<object>>; }>
135135
>this : this
136136
>register : (target: object, heldValue: { readonly ref: WeakRef<object>; readonly set: Set<WeakRef<object>>; }, unregisterToken?: object | undefined) => void
137-
>key : K
137+
>key : object
138138
>{ set: this.#refSet, ref, } : { set: Set<WeakRef<K>>; ref: WeakRef<K>; }
139139

140140
set: this.#refSet,

tests/baselines/reference/genericUnboundedTypeParamAssignability.errors.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
tests/cases/compiler/genericUnboundedTypeParamAssignability.ts(2,5): error TS2339: Property 'toString' does not exist on type 'T'.
2-
tests/cases/compiler/genericUnboundedTypeParamAssignability.ts(15,6): error TS2345: Argument of type 'T' is not assignable to parameter of type '{}'.
2+
tests/cases/compiler/genericUnboundedTypeParamAssignability.ts(15,6): error TS2345: Argument of type 'unknown' is not assignable to parameter of type '{}'.
33
tests/cases/compiler/genericUnboundedTypeParamAssignability.ts(16,6): error TS2345: Argument of type 'T' is not assignable to parameter of type 'Record<string, any>'.
44
tests/cases/compiler/genericUnboundedTypeParamAssignability.ts(17,5): error TS2339: Property 'toString' does not exist on type 'T'.
55

@@ -23,8 +23,7 @@ tests/cases/compiler/genericUnboundedTypeParamAssignability.ts(17,5): error TS23
2323
f1(t);
2424
f2(t); // error in strict, unbounded T doesn't satisfy the constraint
2525
~
26-
!!! error TS2345: Argument of type 'T' is not assignable to parameter of type '{}'.
27-
!!! related TS2208 tests/cases/compiler/genericUnboundedTypeParamAssignability.ts:13:15: This type parameter probably needs an `extends object` constraint.
26+
!!! error TS2345: Argument of type 'unknown' is not assignable to parameter of type '{}'.
2827
f3(t); // error in strict, unbounded T doesn't satisfy the constraint
2928
~
3029
!!! error TS2345: Argument of type 'T' is not assignable to parameter of type 'Record<string, any>'.

tests/baselines/reference/genericUnboundedTypeParamAssignability.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function user<T>(t: T) {
4444
f2(t); // error in strict, unbounded T doesn't satisfy the constraint
4545
>f2(t) : void
4646
>f2 : <T extends {}>(o: T) => void
47-
>t : T
47+
>t : unknown
4848

4949
f3(t); // error in strict, unbounded T doesn't satisfy the constraint
5050
>f3(t) : void

tests/baselines/reference/keyofAndIndexedAccess.errors.txt

Lines changed: 16 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,11 @@
1-
tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts(316,5): error TS2322: Type 'T' is not assignable to type '{}'.
2-
tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts(317,5): error TS2322: Type 'T[keyof T]' is not assignable to type '{}'.
3-
Type 'T[string] | T[number] | T[symbol]' is not assignable to type '{}'.
4-
Type 'T[string]' is not assignable to type '{}'.
5-
tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts(318,5): error TS2322: Type 'T[K]' is not assignable to type '{}'.
6-
Type 'T[keyof T]' is not assignable to type '{}'.
7-
tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts(323,5): error TS2322: Type 'T' is not assignable to type '{} | null | undefined'.
8-
tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts(324,5): error TS2322: Type 'T[keyof T]' is not assignable to type '{} | null | undefined'.
9-
Type 'T[string] | T[number] | T[symbol]' is not assignable to type '{} | null | undefined'.
10-
Type 'T[string]' is not assignable to type '{} | null | undefined'.
11-
tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts(325,5): error TS2322: Type 'T[K]' is not assignable to type '{} | null | undefined'.
12-
Type 'T[keyof T]' is not assignable to type '{} | null | undefined'.
13-
tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts(611,33): error TS2345: Argument of type 'T[K]' is not assignable to parameter of type '{} | null | undefined'.
14-
Type 'T[keyof T]' is not assignable to type '{} | null | undefined'.
15-
Type 'T[string] | T[number] | T[symbol]' is not assignable to type '{} | null | undefined'.
16-
Type 'T[string]' is not assignable to type '{} | null | undefined'.
17-
tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts(619,13): error TS2322: Type 'T[keyof T]' is not assignable to type '{} | null | undefined'.
18-
Type 'T[string] | T[number] | T[symbol]' is not assignable to type '{} | null | undefined'.
19-
Type 'T[string]' is not assignable to type '{} | null | undefined'.
1+
tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts(316,5): error TS2322: Type 'unknown' is not assignable to type '{}'.
2+
tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts(317,5): error TS2322: Type 'unknown' is not assignable to type '{}'.
3+
tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts(318,5): error TS2322: Type 'unknown' is not assignable to type '{}'.
4+
tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts(323,5): error TS2322: Type 'unknown' is not assignable to type '{} | null | undefined'.
5+
tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts(324,5): error TS2322: Type 'unknown' is not assignable to type '{} | null | undefined'.
6+
tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts(325,5): error TS2322: Type 'unknown' is not assignable to type '{} | null | undefined'.
7+
tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts(611,33): error TS2345: Argument of type 'unknown' is not assignable to parameter of type '{} | null | undefined'.
8+
tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts(619,13): error TS2322: Type 'unknown' is not assignable to type '{} | null | undefined'.
209

2110

2211
==== tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts (8 errors) ====
@@ -337,34 +326,26 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts(619,13): error TS23
337326
let a: {};
338327
a = x;
339328
~
340-
!!! error TS2322: Type 'T' is not assignable to type '{}'.
341-
!!! related TS2208 tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts:314:14: This type parameter probably needs an `extends object` constraint.
329+
!!! error TS2322: Type 'unknown' is not assignable to type '{}'.
342330
a = y;
343331
~
344-
!!! error TS2322: Type 'T[keyof T]' is not assignable to type '{}'.
345-
!!! error TS2322: Type 'T[string] | T[number] | T[symbol]' is not assignable to type '{}'.
346-
!!! error TS2322: Type 'T[string]' is not assignable to type '{}'.
332+
!!! error TS2322: Type 'unknown' is not assignable to type '{}'.
347333
a = z;
348334
~
349-
!!! error TS2322: Type 'T[K]' is not assignable to type '{}'.
350-
!!! error TS2322: Type 'T[keyof T]' is not assignable to type '{}'.
335+
!!! error TS2322: Type 'unknown' is not assignable to type '{}'.
351336
}
352337

353338
function f92<T, K extends keyof T>(x: T, y: T[keyof T], z: T[K]) {
354339
let a: {} | null | undefined;
355340
a = x;
356341
~
357-
!!! error TS2322: Type 'T' is not assignable to type '{} | null | undefined'.
358-
!!! related TS2208 tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts:321:14: This type parameter probably needs an `extends object` constraint.
342+
!!! error TS2322: Type 'unknown' is not assignable to type '{} | null | undefined'.
359343
a = y;
360344
~
361-
!!! error TS2322: Type 'T[keyof T]' is not assignable to type '{} | null | undefined'.
362-
!!! error TS2322: Type 'T[string] | T[number] | T[symbol]' is not assignable to type '{} | null | undefined'.
363-
!!! error TS2322: Type 'T[string]' is not assignable to type '{} | null | undefined'.
345+
!!! error TS2322: Type 'unknown' is not assignable to type '{} | null | undefined'.
364346
a = z;
365347
~
366-
!!! error TS2322: Type 'T[K]' is not assignable to type '{} | null | undefined'.
367-
!!! error TS2322: Type 'T[keyof T]' is not assignable to type '{} | null | undefined'.
348+
!!! error TS2322: Type 'unknown' is not assignable to type '{} | null | undefined'.
368349
}
369350

370351
// Repros from #12011
@@ -652,10 +633,7 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts(619,13): error TS23
652633
function fn<T extends I, K extends keyof T>(o: T, k: K) {
653634
take<{} | null | undefined>(o[k]);
654635
~~~~
655-
!!! error TS2345: Argument of type 'T[K]' is not assignable to parameter of type '{} | null | undefined'.
656-
!!! error TS2345: Type 'T[keyof T]' is not assignable to type '{} | null | undefined'.
657-
!!! error TS2345: Type 'T[string] | T[number] | T[symbol]' is not assignable to type '{} | null | undefined'.
658-
!!! error TS2345: Type 'T[string]' is not assignable to type '{} | null | undefined'.
636+
!!! error TS2345: Argument of type 'unknown' is not assignable to parameter of type '{} | null | undefined'.
659637
take<any>(o[k]);
660638
}
661639

@@ -665,9 +643,7 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts(619,13): error TS23
665643
foo(x: T[keyof T]) {
666644
let y: {} | undefined | null = x;
667645
~
668-
!!! error TS2322: Type 'T[keyof T]' is not assignable to type '{} | null | undefined'.
669-
!!! error TS2322: Type 'T[string] | T[number] | T[symbol]' is not assignable to type '{} | null | undefined'.
670-
!!! error TS2322: Type 'T[string]' is not assignable to type '{} | null | undefined'.
646+
!!! error TS2322: Type 'unknown' is not assignable to type '{} | null | undefined'.
671647
}
672648
}
673649

0 commit comments

Comments
 (0)