Skip to content

Commit b705f41

Browse files
Accepted baselines.
1 parent 891aa24 commit b705f41

15 files changed

+58
-84
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

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: 4 additions & 4 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];

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

Lines changed: 4 additions & 4 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];

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

tests/baselines/reference/keyofAndIndexedAccess.types

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,19 +1268,19 @@ function f91<T, K extends keyof T>(x: T, y: T[keyof T], z: T[K]) {
12681268
>a : {}
12691269

12701270
a = x;
1271-
>a = x : T
1271+
>a = x : unknown
12721272
>a : {}
1273-
>x : T
1273+
>x : unknown
12741274

12751275
a = y;
1276-
>a = y : T[keyof T]
1276+
>a = y : unknown
12771277
>a : {}
1278-
>y : T[keyof T]
1278+
>y : unknown
12791279

12801280
a = z;
1281-
>a = z : T[K]
1281+
>a = z : unknown
12821282
>a : {}
1283-
>z : T[K]
1283+
>z : unknown
12841284
}
12851285

12861286
function f92<T, K extends keyof T>(x: T, y: T[keyof T], z: T[K]) {
@@ -1294,19 +1294,19 @@ function f92<T, K extends keyof T>(x: T, y: T[keyof T], z: T[K]) {
12941294
>null : null
12951295

12961296
a = x;
1297-
>a = x : T
1297+
>a = x : unknown
12981298
>a : {} | null | undefined
1299-
>x : T
1299+
>x : unknown
13001300

13011301
a = y;
1302-
>a = y : T[keyof T]
1302+
>a = y : unknown
13031303
>a : {} | null | undefined
1304-
>y : T[keyof T]
1304+
>y : unknown
13051305

13061306
a = z;
1307-
>a = z : T[K]
1307+
>a = z : unknown
13081308
>a : {} | null | undefined
1309-
>z : T[K]
1309+
>z : unknown
13101310
}
13111311

13121312
// Repros from #12011
@@ -2065,7 +2065,7 @@ function fn<T extends I, K extends keyof T>(o: T, k: K) {
20652065
>take<{} | null | undefined>(o[k]) : void
20662066
>take : <T>(p: T) => void
20672067
>null : null
2068-
>o[k] : T[K]
2068+
>o[k] : unknown
20692069
>o : T
20702070
>k : K
20712071

@@ -2089,7 +2089,7 @@ class Unbounded<T> {
20892089
let y: {} | undefined | null = x;
20902090
>y : {} | null | undefined
20912091
>null : null
2092-
>x : T[keyof T]
2092+
>x : unknown
20932093
}
20942094
}
20952095

tests/baselines/reference/logicalOrOperatorWithTypeParameters.types

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ function fn1<T, U>(t: T, u: U) {
2424

2525
var r4: {} = t || u;
2626
>r4 : {}
27-
>t || u : T | U
28-
>t : T
29-
>u : U
27+
>t || u : unknown
28+
>t : unknown
29+
>u : unknown
3030
}
3131

3232
function fn2<T, U/* extends T*/, V/* extends T*/>(t: T, u: U, v: V) {
@@ -62,9 +62,9 @@ function fn2<T, U/* extends T*/, V/* extends T*/>(t: T, u: U, v: V) {
6262

6363
var r6: {} = u || v;
6464
>r6 : {}
65-
>u || v : U | V
66-
>u : U
67-
>v : V
65+
>u || v : unknown
66+
>u : unknown
67+
>v : unknown
6868

6969
//var r7: T = u || v;
7070
}

tests/baselines/reference/nonPrimitiveAndTypeVariables.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
tests/cases/conformance/types/nonPrimitive/nonPrimitiveAndTypeVariables.ts(10,9): error TS2322: Type 'T' is not assignable to type 'object'.
1+
tests/cases/conformance/types/nonPrimitive/nonPrimitiveAndTypeVariables.ts(10,9): error TS2322: Type 'unknown' is not assignable to type 'object'.
22
tests/cases/conformance/types/nonPrimitive/nonPrimitiveAndTypeVariables.ts(11,9): error TS2322: Type 'T' is not assignable to type 'object | U'.
33

44

@@ -14,7 +14,7 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveAndTypeVariables.ts(11,9)
1414
function foo<T, U>(x: T) {
1515
let a: object = x; // Error
1616
~
17-
!!! error TS2322: Type 'T' is not assignable to type 'object'.
17+
!!! error TS2322: Type 'unknown' is not assignable to type 'object'.
1818
let b: U | object = x; // Error
1919
~
2020
!!! error TS2322: Type 'T' is not assignable to type 'object | U'.

tests/baselines/reference/nonPrimitiveAndTypeVariables.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function foo<T, U>(x: T) {
2727

2828
let a: object = x; // Error
2929
>a : object
30-
>x : T
30+
>x : unknown
3131

3232
let b: U | object = x; // Error
3333
>b : object | U

tests/baselines/reference/nonPrimitiveInGeneric.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(2,9): error TS2322: Type 'T' is not assignable to type 'object'.
1+
tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(2,9): error TS2322: Type 'unknown' is not assignable to type 'object'.
22
tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(9,17): error TS2345: Argument of type 'number' is not assignable to parameter of type 'object'.
33
tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(10,17): error TS2345: Argument of type 'string' is not assignable to parameter of type 'object'.
44
tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(18,7): error TS2345: Argument of type 'number' is not assignable to parameter of type 'object'.
@@ -12,7 +12,7 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(34,14): erro
1212
function generic<T>(t: T) {
1313
var o: object = t; // expect error
1414
~
15-
!!! error TS2322: Type 'T' is not assignable to type 'object'.
15+
!!! error TS2322: Type 'unknown' is not assignable to type 'object'.
1616
}
1717
var a = {};
1818
var b = "42";

tests/baselines/reference/nonPrimitiveInGeneric.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function generic<T>(t: T) {
55

66
var o: object = t; // expect error
77
>o : object
8-
>t : T
8+
>t : unknown
99
}
1010
var a = {};
1111
>a : {}

tests/baselines/reference/unknownType1.errors.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ tests/cases/conformance/types/unknown/unknownType1.ts(144,29): error TS2698: Spr
2424
tests/cases/conformance/types/unknown/unknownType1.ts(150,17): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
2525
tests/cases/conformance/types/unknown/unknownType1.ts(156,14): error TS2700: Rest types may only be created from object types.
2626
tests/cases/conformance/types/unknown/unknownType1.ts(162,5): error TS2564: Property 'a' has no initializer and is not definitely assigned in the constructor.
27-
tests/cases/conformance/types/unknown/unknownType1.ts(170,9): error TS2322: Type 'T' is not assignable to type '{}'.
27+
tests/cases/conformance/types/unknown/unknownType1.ts(170,9): error TS2322: Type 'unknown' is not assignable to type '{}'.
2828
tests/cases/conformance/types/unknown/unknownType1.ts(171,9): error TS2322: Type 'unknown' is not assignable to type '{}'.
2929
tests/cases/conformance/types/unknown/unknownType1.ts(181,5): error TS2322: Type 'unknown' is not assignable to type '{}'.
3030

@@ -252,8 +252,7 @@ tests/cases/conformance/types/unknown/unknownType1.ts(181,5): error TS2322: Type
252252
function f30<T, U extends unknown>(t: T, u: U) {
253253
let x: {} = t;
254254
~
255-
!!! error TS2322: Type 'T' is not assignable to type '{}'.
256-
!!! related TS2208 tests/cases/conformance/types/unknown/unknownType1.ts:169:14: This type parameter probably needs an `extends object` constraint.
255+
!!! error TS2322: Type 'unknown' is not assignable to type '{}'.
257256
let y: {} = u;
258257
~
259258
!!! error TS2322: Type 'unknown' is not assignable to type '{}'.

tests/baselines/reference/unknownType1.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ function f30<T, U extends unknown>(t: T, u: U) {
469469

470470
let x: {} = t;
471471
>x : {}
472-
>t : T
472+
>t : unknown
473473

474474
let y: {} = u;
475475
>y : {}

0 commit comments

Comments
 (0)