Skip to content

Commit eaf872c

Browse files
committed
Accept new baselines
1 parent ace0904 commit eaf872c

8 files changed

+35
-26
lines changed

tests/baselines/reference/discriminatedUnionTypes2.errors.txt

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ tests/cases/conformance/types/union/discriminatedUnionTypes2.ts(27,30): error TS
22
Object literal may only specify known properties, and 'c' does not exist in type '{ a: null; b: string; }'.
33
tests/cases/conformance/types/union/discriminatedUnionTypes2.ts(32,11): error TS2339: Property 'b' does not exist on type '{ a: 0; b: string; } | { a: T; c: number; }'.
44
Property 'b' does not exist on type '{ a: T; c: number; }'.
5-
tests/cases/conformance/types/union/discriminatedUnionTypes2.ts(132,11): error TS2339: Property 'value' does not exist on type 'never'.
65

76

8-
==== tests/cases/conformance/types/union/discriminatedUnionTypes2.ts (3 errors) ====
7+
==== tests/cases/conformance/types/union/discriminatedUnionTypes2.ts (2 errors) ====
98
function f10(x : { kind: false, a: string } | { kind: true, b: string } | { kind: string, c: string }) {
109
if (x.kind === false) {
1110
x.a;
@@ -144,8 +143,6 @@ tests/cases/conformance/types/union/discriminatedUnionTypes2.ts(132,11): error T
144143
}
145144
else {
146145
x.value; // Error, x is never
147-
~~~~~
148-
!!! error TS2339: Property 'value' does not exist on type 'never'.
149146
}
150147
}
151148

tests/baselines/reference/discriminatedUnionTypes2.symbols

+8-6
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,9 @@ function f(problem: abc & (b | c)) {
317317
>c : Symbol(c, Decl(discriminatedUnionTypes2.ts, 104, 1))
318318

319319
if (problem.type === 'b') {
320-
>problem.type : Symbol(type, Decl(discriminatedUnionTypes2.ts, 101, 10), Decl(discriminatedUnionTypes2.ts, 105, 10), Decl(discriminatedUnionTypes2.ts, 97, 10), Decl(discriminatedUnionTypes2.ts, 101, 10), Decl(discriminatedUnionTypes2.ts, 97, 10) ... and 5 more)
320+
>problem.type : Symbol(type, Decl(discriminatedUnionTypes2.ts, 101, 10), Decl(discriminatedUnionTypes2.ts, 105, 10))
321321
>problem : Symbol(problem, Decl(discriminatedUnionTypes2.ts, 112, 11))
322-
>type : Symbol(type, Decl(discriminatedUnionTypes2.ts, 101, 10), Decl(discriminatedUnionTypes2.ts, 105, 10), Decl(discriminatedUnionTypes2.ts, 97, 10), Decl(discriminatedUnionTypes2.ts, 101, 10), Decl(discriminatedUnionTypes2.ts, 97, 10) ... and 5 more)
322+
>type : Symbol(type, Decl(discriminatedUnionTypes2.ts, 101, 10), Decl(discriminatedUnionTypes2.ts, 105, 10))
323323

324324
problem.name;
325325
>problem.name : Symbol(name, Decl(discriminatedUnionTypes2.ts, 102, 14))
@@ -356,9 +356,9 @@ function foo1(x: RuntimeValue & { type: 'number' }) {
356356
>type : Symbol(type, Decl(discriminatedUnionTypes2.ts, 126, 33))
357357

358358
if (x.type === 'number') {
359-
>x.type : Symbol(type, Decl(discriminatedUnionTypes2.ts, 122, 7), Decl(discriminatedUnionTypes2.ts, 126, 33), Decl(discriminatedUnionTypes2.ts, 123, 7), Decl(discriminatedUnionTypes2.ts, 126, 33), Decl(discriminatedUnionTypes2.ts, 124, 7) ... and 1 more)
359+
>x.type : Symbol(type, Decl(discriminatedUnionTypes2.ts, 122, 7), Decl(discriminatedUnionTypes2.ts, 126, 33))
360360
>x : Symbol(x, Decl(discriminatedUnionTypes2.ts, 126, 14))
361-
>type : Symbol(type, Decl(discriminatedUnionTypes2.ts, 122, 7), Decl(discriminatedUnionTypes2.ts, 126, 33), Decl(discriminatedUnionTypes2.ts, 123, 7), Decl(discriminatedUnionTypes2.ts, 126, 33), Decl(discriminatedUnionTypes2.ts, 124, 7) ... and 1 more)
361+
>type : Symbol(type, Decl(discriminatedUnionTypes2.ts, 122, 7), Decl(discriminatedUnionTypes2.ts, 126, 33))
362362

363363
x.value; // number
364364
>x.value : Symbol(value, Decl(discriminatedUnionTypes2.ts, 122, 23))
@@ -367,7 +367,9 @@ function foo1(x: RuntimeValue & { type: 'number' }) {
367367
}
368368
else {
369369
x.value; // Error, x is never
370+
>x.value : Symbol(value, Decl(discriminatedUnionTypes2.ts, 122, 23))
370371
>x : Symbol(x, Decl(discriminatedUnionTypes2.ts, 126, 14))
372+
>value : Symbol(value, Decl(discriminatedUnionTypes2.ts, 122, 23))
371373
}
372374
}
373375

@@ -379,9 +381,9 @@ function foo2(x: RuntimeValue & ({ type: 'number' } | { type: 'string' })) {
379381
>type : Symbol(type, Decl(discriminatedUnionTypes2.ts, 135, 55))
380382

381383
if (x.type === 'number') {
382-
>x.type : Symbol(type, Decl(discriminatedUnionTypes2.ts, 122, 7), Decl(discriminatedUnionTypes2.ts, 135, 34), Decl(discriminatedUnionTypes2.ts, 122, 7), Decl(discriminatedUnionTypes2.ts, 135, 55), Decl(discriminatedUnionTypes2.ts, 123, 7) ... and 7 more)
384+
>x.type : Symbol(type, Decl(discriminatedUnionTypes2.ts, 122, 7), Decl(discriminatedUnionTypes2.ts, 135, 34), Decl(discriminatedUnionTypes2.ts, 123, 7), Decl(discriminatedUnionTypes2.ts, 135, 55))
383385
>x : Symbol(x, Decl(discriminatedUnionTypes2.ts, 135, 14))
384-
>type : Symbol(type, Decl(discriminatedUnionTypes2.ts, 122, 7), Decl(discriminatedUnionTypes2.ts, 135, 34), Decl(discriminatedUnionTypes2.ts, 122, 7), Decl(discriminatedUnionTypes2.ts, 135, 55), Decl(discriminatedUnionTypes2.ts, 123, 7) ... and 7 more)
386+
>type : Symbol(type, Decl(discriminatedUnionTypes2.ts, 122, 7), Decl(discriminatedUnionTypes2.ts, 135, 34), Decl(discriminatedUnionTypes2.ts, 123, 7), Decl(discriminatedUnionTypes2.ts, 135, 55))
385387

386388
x.value; // number
387389
>x.value : Symbol(value, Decl(discriminatedUnionTypes2.ts, 122, 23))

tests/baselines/reference/discriminatedUnionTypes2.types

+8-8
Original file line numberDiff line numberDiff line change
@@ -335,13 +335,13 @@ function f(problem: abc & (b | c)) {
335335

336336
problem.name;
337337
>problem.name : string
338-
>problem : b
338+
>problem : b | (a & b) | (a & c) | (b & c) | (c & b)
339339
>name : string
340340
}
341341
else {
342342
problem.other;
343343
>problem.other : string
344-
>problem : c
344+
>problem : c | (a & b) | (a & c) | (b & c) | (c & b)
345345
>other : string
346346
}
347347
}
@@ -375,14 +375,14 @@ function foo1(x: RuntimeValue & { type: 'number' }) {
375375

376376
x.value; // number
377377
>x.value : number
378-
>x : { type: "number"; value: number; } & { type: "number"; }
378+
>x : ({ type: "number"; value: number; } & { type: "number"; }) | ({ type: "string"; value: string; } & { type: "number"; }) | ({ type: "boolean"; value: boolean; } & { type: "number"; })
379379
>value : number
380380
}
381381
else {
382382
x.value; // Error, x is never
383-
>x.value : any
384-
>x : never
385-
>value : any
383+
>x.value : number
384+
>x : ({ type: "number"; value: number; } & { type: "number"; }) | ({ type: "string"; value: string; } & { type: "number"; }) | ({ type: "boolean"; value: boolean; } & { type: "number"; })
385+
>value : number
386386
}
387387
}
388388

@@ -401,13 +401,13 @@ function foo2(x: RuntimeValue & ({ type: 'number' } | { type: 'string' })) {
401401

402402
x.value; // number
403403
>x.value : number
404-
>x : { type: "number"; value: number; } & { type: "number"; }
404+
>x : ({ type: "number"; value: number; } & { type: "number"; }) | ({ type: "number"; value: number; } & { type: "string"; }) | ({ type: "string"; value: string; } & { type: "number"; }) | ({ type: "boolean"; value: boolean; } & { type: "number"; }) | ({ type: "boolean"; value: boolean; } & { type: "string"; })
405405
>value : number
406406
}
407407
else {
408408
x.value; // string
409409
>x.value : string
410-
>x : { type: "string"; value: string; } & { type: "string"; }
410+
>x : ({ type: "number"; value: number; } & { type: "string"; }) | ({ type: "string"; value: string; } & { type: "number"; }) | ({ type: "string"; value: string; } & { type: "string"; }) | ({ type: "boolean"; value: boolean; } & { type: "number"; }) | ({ type: "boolean"; value: boolean; } & { type: "string"; })
411411
>value : string
412412
}
413413
}

tests/baselines/reference/tsxUnionElementType1.errors.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,4 @@ tests/cases/conformance/jsx/file.tsx(12,10): error TS2322: Type 'true' is not as
1515
var SFCComp = SFC1 || SFC2;
1616
<SFCComp x />
1717
~
18-
!!! error TS2322: Type 'true' is not assignable to type 'never'.
19-
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:3:23: The expected type comes from property 'x' which is declared here on type 'IntrinsicAttributes & { x: number; } & { x: boolean; }'
18+
!!! error TS2322: Type 'true' is not assignable to type 'never'.

tests/baselines/reference/tsxUnionElementType2.errors.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,4 @@ tests/cases/conformance/jsx/file.tsx(12,10): error TS2322: Type 'string' is not
1515
var SFCComp = SFC1 || SFC2;
1616
<SFCComp x={"hi"}/>
1717
~
18-
!!! error TS2322: Type 'string' is not assignable to type 'never'.
19-
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:3:23: The expected type comes from property 'x' which is declared here on type 'IntrinsicAttributes & { x: number; } & { x: boolean; }'
18+
!!! error TS2322: Type 'string' is not assignable to type 'never'.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOf.ts(7,20): error TS2339: Property 'global' does not exist on type 'I & RegExp'.
2+
3+
4+
==== tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOf.ts (1 errors) ====
5+
interface I { global: string; }
6+
var result: I;
7+
var result2: I;
8+
9+
if (!(result instanceof RegExp)) {
10+
result = result2;
11+
} else if (!result.global) {
12+
~~~~~~
13+
!!! error TS2339: Property 'global' does not exist on type 'I & RegExp'.
14+
}

tests/baselines/reference/typeGuardsWithInstanceOf.symbols

-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,5 @@ if (!(result instanceof RegExp)) {
2020
>result2 : Symbol(result2, Decl(typeGuardsWithInstanceOf.ts, 2, 3))
2121

2222
} else if (!result.global) {
23-
>result.global : Symbol(global, Decl(typeGuardsWithInstanceOf.ts, 0, 13), Decl(lib.es5.d.ts, --, --))
2423
>result : Symbol(result, Decl(typeGuardsWithInstanceOf.ts, 1, 3))
25-
>global : Symbol(global, Decl(typeGuardsWithInstanceOf.ts, 0, 13), Decl(lib.es5.d.ts, --, --))
2624
}

tests/baselines/reference/typeGuardsWithInstanceOf.types

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if (!(result instanceof RegExp)) {
2222

2323
} else if (!result.global) {
2424
>!result.global : boolean
25-
>result.global : never
25+
>result.global : any
2626
>result : I & RegExp
27-
>global : never
27+
>global : any
2828
}

0 commit comments

Comments
 (0)