Accept new baselines

This commit is contained in:
Anders Hejlsberg
2016-08-03 10:05:49 -07:00
parent 7ab6e11aaf
commit 917d18a1ca
5 changed files with 16 additions and 13 deletions
@@ -55,5 +55,5 @@ function rawr(dino: RexOrRaptor) {
throw "Unexpected " + dino;
>"Unexpected " + dino : string
>"Unexpected " : string
>dino : "t-rex"
>dino : never
}
@@ -15,7 +15,7 @@ if (typeof stringOrNumber === "number") {
>"number" : "number"
stringOrNumber;
>stringOrNumber : string
>stringOrNumber : never
}
}
@@ -31,6 +31,6 @@ if (typeof stringOrNumber === "number" && typeof stringOrNumber !== "number") {
>"number" : "number"
stringOrNumber;
>stringOrNumber : string
>stringOrNumber : never
}
@@ -47,7 +47,7 @@ function test2(a: any) {
>"boolean" : "boolean"
a;
>a : boolean
>a : never
}
else {
a;
@@ -129,7 +129,7 @@ function test5(a: boolean | void) {
}
else {
a;
>a : void
>a : never
}
}
else {
@@ -188,7 +188,7 @@ function test7(a: boolean | void) {
}
else {
a;
>a : void
>a : never
}
}
@@ -193,10 +193,10 @@ function f1() {
>x : undefined
x; // string | number (guard as assertion)
>x : string | number
>x : never
}
x; // string | number | undefined
>x : string | number | undefined
>x : undefined
}
function f2() {
@@ -216,10 +216,10 @@ function f2() {
>"string" : "string"
x; // string (guard as assertion)
>x : string
>x : never
}
x; // string | undefined
>x : string | undefined
>x : undefined
}
function f3() {
@@ -239,7 +239,7 @@ function f3() {
return;
}
x; // string | number (guard as assertion)
>x : string | number
>x : never
}
function f4() {
@@ -281,7 +281,7 @@ function f5(x: string | number) {
>"number" : "number"
x; // number (guard as assertion)
>x : number
>x : never
}
else {
x; // string | number
@@ -1,9 +1,10 @@
tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts(22,10): error TS2354: No best common type exists among return expressions.
tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts(31,10): error TS2354: No best common type exists among return expressions.
tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts(49,10): error TS2354: No best common type exists among return expressions.
tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts(139,17): error TS2339: Property 'toString' does not exist on type 'never'.
==== tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts (3 errors) ====
==== tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts (4 errors) ====
// In the true branch statement of an 'if' statement,
// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when true.
// In the false branch statement of an 'if' statement,
@@ -149,5 +150,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts(49,10)
return typeof x === "number"
? x.toString() // number
: x.toString(); // boolean | string
~~~~~~~~
!!! error TS2339: Property 'toString' does not exist on type 'never'.
}
}