Skip to content

Commit 917d18a

Browse files
committed
Accept new baselines
1 parent 7ab6e11 commit 917d18a

5 files changed

+16
-13
lines changed

tests/baselines/reference/stringLiteralTypesAndTuples01.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,5 @@ function rawr(dino: RexOrRaptor) {
5555
throw "Unexpected " + dino;
5656
>"Unexpected " + dino : string
5757
>"Unexpected " : string
58-
>dino : "t-rex"
58+
>dino : never
5959
}

tests/baselines/reference/typeGuardTautologicalConsistiency.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if (typeof stringOrNumber === "number") {
1515
>"number" : "number"
1616

1717
stringOrNumber;
18-
>stringOrNumber : string
18+
>stringOrNumber : never
1919
}
2020
}
2121

@@ -31,6 +31,6 @@ if (typeof stringOrNumber === "number" && typeof stringOrNumber !== "number") {
3131
>"number" : "number"
3232

3333
stringOrNumber;
34-
>stringOrNumber : string
34+
>stringOrNumber : never
3535
}
3636

tests/baselines/reference/typeGuardTypeOfUndefined.types

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function test2(a: any) {
4747
>"boolean" : "boolean"
4848

4949
a;
50-
>a : boolean
50+
>a : never
5151
}
5252
else {
5353
a;
@@ -129,7 +129,7 @@ function test5(a: boolean | void) {
129129
}
130130
else {
131131
a;
132-
>a : void
132+
>a : never
133133
}
134134
}
135135
else {
@@ -188,7 +188,7 @@ function test7(a: boolean | void) {
188188
}
189189
else {
190190
a;
191-
>a : void
191+
>a : never
192192
}
193193
}
194194

tests/baselines/reference/typeGuardsAsAssertions.types

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,10 @@ function f1() {
193193
>x : undefined
194194

195195
x; // string | number (guard as assertion)
196-
>x : string | number
196+
>x : never
197197
}
198198
x; // string | number | undefined
199-
>x : string | number | undefined
199+
>x : undefined
200200
}
201201

202202
function f2() {
@@ -216,10 +216,10 @@ function f2() {
216216
>"string" : "string"
217217

218218
x; // string (guard as assertion)
219-
>x : string
219+
>x : never
220220
}
221221
x; // string | undefined
222-
>x : string | undefined
222+
>x : undefined
223223
}
224224

225225
function f3() {
@@ -239,7 +239,7 @@ function f3() {
239239
return;
240240
}
241241
x; // string | number (guard as assertion)
242-
>x : string | number
242+
>x : never
243243
}
244244

245245
function f4() {
@@ -281,7 +281,7 @@ function f5(x: string | number) {
281281
>"number" : "number"
282282

283283
x; // number (guard as assertion)
284-
>x : number
284+
>x : never
285285
}
286286
else {
287287
x; // string | number

tests/baselines/reference/typeGuardsInIfStatement.errors.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts(22,10): error TS2354: No best common type exists among return expressions.
22
tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts(31,10): error TS2354: No best common type exists among return expressions.
33
tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts(49,10): error TS2354: No best common type exists among return expressions.
4+
tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts(139,17): error TS2339: Property 'toString' does not exist on type 'never'.
45

56

6-
==== tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts (3 errors) ====
7+
==== tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts (4 errors) ====
78
// In the true branch statement of an 'if' statement,
89
// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when true.
910
// In the false branch statement of an 'if' statement,
@@ -149,5 +150,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts(49,10)
149150
return typeof x === "number"
150151
? x.toString() // number
151152
: x.toString(); // boolean | string
153+
~~~~~~~~
154+
!!! error TS2339: Property 'toString' does not exist on type 'never'.
152155
}
153156
}

0 commit comments

Comments
 (0)