Skip to content

Commit 4bf6ae7

Browse files
committed
Accept new baselines
1 parent 16c1d9d commit 4bf6ae7

11 files changed

+49
-36
lines changed

tests/baselines/reference/conditionalTypes1.errors.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ conditionalTypes1.ts(288,43): error TS2322: Type 'T95<U>' is not assignable to t
8888
!!! error TS2322: Type 'T' is not assignable to type 'NonNullable<T>'.
8989
!!! error TS2322: Type 'T' is not assignable to type '{}'.
9090
!!! related TS2208 conditionalTypes1.ts:10:13: This type parameter might need an `extends {}` constraint.
91+
!!! related TS2208 conditionalTypes1.ts:10:13: This type parameter might need an `extends NonNullable<T>` constraint.
9192
}
9293

9394
function f2<T extends string | undefined>(x: T, y: NonNullable<T>) {

tests/baselines/reference/inKeywordAndUnknown.types

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,12 @@ function f5<T>(x: T & {}) {
138138

139139
function f6<T extends {}>(x: T & {}) {
140140
>f6 : <T extends {}>(x: T & {}) => boolean
141-
>x : T & {}
141+
>x : T
142142

143143
return x instanceof Object && 'a' in x;
144144
>x instanceof Object && 'a' in x : boolean
145145
>x instanceof Object : boolean
146-
>x : T & {}
146+
>x : T
147147
>Object : ObjectConstructor
148148
>'a' in x : boolean
149149
>'a' : "a"
@@ -152,15 +152,15 @@ function f6<T extends {}>(x: T & {}) {
152152

153153
function f7<T extends object>(x: T & {}) {
154154
>f7 : <T extends object>(x: T & {}) => boolean
155-
>x : T & {}
155+
>x : T
156156

157157
return x instanceof Object && 'a' in x;
158158
>x instanceof Object && 'a' in x : boolean
159159
>x instanceof Object : boolean
160-
>x : T & {}
160+
>x : T
161161
>Object : ObjectConstructor
162162
>'a' in x : boolean
163163
>'a' : "a"
164-
>x : T & {}
164+
>x : T
165165
}
166166

tests/baselines/reference/inKeywordTypeguard(strict=false).types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,12 +1078,12 @@ function isHTMLTable<T extends object | null>(table: T): boolean {
10781078
const f = <P extends object>(a: P & {}) => {
10791079
>f : <P extends object>(a: P & {}) => void
10801080
><P extends object>(a: P & {}) => { "foo" in a;} : <P extends object>(a: P & {}) => void
1081-
>a : P & {}
1081+
>a : P
10821082

10831083
"foo" in a;
10841084
>"foo" in a : boolean
10851085
>"foo" : "foo"
1086-
>a : P & {}
1086+
>a : P
10871087

10881088
};
10891089

tests/baselines/reference/inKeywordTypeguard(strict=true).types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,12 +1078,12 @@ function isHTMLTable<T extends object | null>(table: T): boolean {
10781078
const f = <P extends object>(a: P & {}) => {
10791079
>f : <P extends object>(a: P & {}) => void
10801080
><P extends object>(a: P & {}) => { "foo" in a;} : <P extends object>(a: P & {}) => void
1081-
>a : P & {}
1081+
>a : P
10821082

10831083
"foo" in a;
10841084
>"foo" in a : boolean
10851085
>"foo" : "foo"
1086-
>a : P & {}
1086+
>a : P
10871087

10881088
};
10891089

tests/baselines/reference/indexSignatures1.errors.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ indexSignatures1.ts(73,5): error TS2374: Duplicate index signature for type '`fo
1515
indexSignatures1.ts(81,5): error TS2413: '`a${string}a`' index type '"c"' is not assignable to '`${string}a`' index type '"b"'.
1616
indexSignatures1.ts(81,5): error TS2413: '`a${string}a`' index type '"c"' is not assignable to '`a${string}`' index type '"a"'.
1717
indexSignatures1.ts(87,6): error TS1337: An index signature parameter type cannot be a literal type or generic type. Consider using a mapped object type instead.
18+
indexSignatures1.ts(88,5): error TS2374: Duplicate index signature for type 'T'.
1819
indexSignatures1.ts(88,6): error TS1337: An index signature parameter type cannot be a literal type or generic type. Consider using a mapped object type instead.
1920
indexSignatures1.ts(89,6): error TS1268: An index signature parameter type must be 'string', 'number', 'symbol', or a template literal type.
21+
indexSignatures1.ts(90,5): error TS2374: Duplicate index signature for type 'T'.
2022
indexSignatures1.ts(90,6): error TS1337: An index signature parameter type cannot be a literal type or generic type. Consider using a mapped object type instead.
2123
indexSignatures1.ts(117,1): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'I1'.
2224
No index signature with a parameter of type 'string' was found on type 'I1'.
@@ -69,7 +71,7 @@ indexSignatures1.ts(289,7): error TS2322: Type 'number' is not assignable to typ
6971
indexSignatures1.ts(312,43): error TS2353: Object literal may only specify known properties, and '[sym]' does not exist in type '{ [key: number]: string; }'.
7072

7173

72-
==== indexSignatures1.ts (50 errors) ====
74+
==== indexSignatures1.ts (52 errors) ====
7375
// Symbol index signature checking
7476

7577
const sym = Symbol();
@@ -188,12 +190,16 @@ indexSignatures1.ts(312,43): error TS2353: Object literal may only specify known
188190
~~~
189191
!!! error TS1337: An index signature parameter type cannot be a literal type or generic type. Consider using a mapped object type instead.
190192
[key: T | number]: string; // Error
193+
~~~~~~~~~~~~~~~~~~~~~~~~~~
194+
!!! error TS2374: Duplicate index signature for type 'T'.
191195
~~~
192196
!!! error TS1337: An index signature parameter type cannot be a literal type or generic type. Consider using a mapped object type instead.
193197
[key: Error]: string; // Error
194198
~~~
195199
!!! error TS1268: An index signature parameter type must be 'string', 'number', 'symbol', or a template literal type.
196200
[key: T & string]: string; // Error
201+
~~~~~~~~~~~~~~~~~~~~~~~~~~
202+
!!! error TS2374: Duplicate index signature for type 'T'.
197203
~~~
198204
!!! error TS1337: An index signature parameter type cannot be a literal type or generic type. Consider using a mapped object type instead.
199205
}

tests/baselines/reference/indexSignatures1.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ type Invalid<T extends string> = {
261261
>key : Error
262262

263263
[key: T & string]: string; // Error
264-
>key : T & string
264+
>key : T
265265
}
266266

267267
// Intersections in index signatures

tests/baselines/reference/intersectionWithUnionConstraint.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type T1 = (string | number | undefined) & (string | null | undefined); // strin
4545

4646
function f3<T extends string | number | undefined>(x: T & (number | object | undefined)) {
4747
>f3 : <T extends string | number | undefined>(x: T & (number | object | undefined)) => void
48-
>x : T & (number | object | undefined)
48+
>x : (T & undefined) | (T & number)
4949

5050
const y: number | undefined = x;
5151
>y : number | undefined
@@ -54,7 +54,7 @@ function f3<T extends string | number | undefined>(x: T & (number | object | und
5454

5555
function f4<T extends string | number>(x: T & (number | object)) {
5656
>f4 : <T extends string | number>(x: T & (number | object)) => void
57-
>x : T & (number | object)
57+
>x : T & number
5858

5959
const y: number = x;
6060
>y : number

tests/baselines/reference/spreadObjectOrFalsy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ declare function f5<S, T extends undefined>(a: S | T): S | T;
113113
declare function f6<T extends object | undefined>(a: T): T;
114114
declare function g1<T extends {}, A extends {
115115
z: (T | undefined) & T;
116-
}>(a: A): T | (undefined & T);
116+
}>(a: A): T;
117117
interface DatafulFoo<T> {
118118
data: T;
119119
}

tests/baselines/reference/spreadObjectOrFalsy.types

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,19 @@ function f6<T extends object | undefined>(a: T) {
5858
// Repro from #46976
5959

6060
function g1<T extends {}, A extends { z: (T | undefined) & T }>(a: A) {
61-
>g1 : <T extends {}, A extends { z: (T | undefined) & T; }>(a: A) => T | (undefined & T)
62-
>z : T | (undefined & T)
61+
>g1 : <T extends {}, A extends { z: (T | undefined) & T; }>(a: A) => T
62+
>z : T
6363
>a : A
6464

6565
const { z } = a;
66-
>z : T | (undefined & T)
66+
>z : T
6767
>a : A
6868

6969
return {
70-
>{ ...z } : T | (undefined & T)
70+
>{ ...z } : T
7171

7272
...z
73-
>z : T | (undefined & T)
73+
>z : T
7474

7575
};
7676
}
@@ -100,9 +100,9 @@ class Foo<T extends string> {
100100
this.data.toLocaleLowerCase();
101101
>this.data.toLocaleLowerCase() : string
102102
>this.data.toLocaleLowerCase : (locales?: string | string[] | undefined) => string
103-
>this.data : T | (undefined & T)
103+
>this.data : T
104104
>this : this & DatafulFoo<T>
105-
>data : T | (undefined & T)
105+
>data : T
106106
>toLocaleLowerCase : (locales?: string | string[] | undefined) => string
107107
}
108108
}

tests/baselines/reference/unknownControlFlow.errors.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ unknownControlFlow.ts(283,5): error TS2536: Type 'keyof (T & {})' cannot be used
33
unknownControlFlow.ts(290,11): error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'.
44
unknownControlFlow.ts(291,5): error TS2345: Argument of type 'null' is not assignable to parameter of type 'never'.
55
unknownControlFlow.ts(293,5): error TS2345: Argument of type 'null' is not assignable to parameter of type 'never'.
6+
unknownControlFlow.ts(323,9): error TS2367: This comparison appears to be unintentional because the types 'T' and 'number' have no overlap.
7+
unknownControlFlow.ts(341,9): error TS2367: This comparison appears to be unintentional because the types 'T' and 'number' have no overlap.
68

79

8-
==== unknownControlFlow.ts (5 errors) ====
10+
==== unknownControlFlow.ts (7 errors) ====
911
type T01 = {} & string; // {} & string
1012
type T02 = {} & 'a'; // 'a'
1113
type T03 = {} & object; // object
@@ -339,6 +341,8 @@ unknownControlFlow.ts(293,5): error TS2345: Argument of type 'null' is not assig
339341

340342
function fx2<T extends {}>(value: T & ({} | null)) {
341343
if (value === 42) {
344+
~~~~~~~~~~~~
345+
!!! error TS2367: This comparison appears to be unintentional because the types 'T' and 'number' have no overlap.
342346
value; // T & {}
343347
}
344348
else {
@@ -357,6 +361,8 @@ unknownControlFlow.ts(293,5): error TS2345: Argument of type 'null' is not assig
357361

358362
function fx4<T extends {} | null>(value: T & ({} | null)) {
359363
if (value === 42) {
364+
~~~~~~~~~~~~
365+
!!! error TS2367: This comparison appears to be unintentional because the types 'T' and 'number' have no overlap.
360366
value; // T & {}
361367
}
362368
else {

0 commit comments

Comments
 (0)