mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 11:35:42 -06:00
Fix some tests
This commit is contained in:
parent
c6f4de3607
commit
e53f390b3e
@ -41,12 +41,11 @@ else {
|
||||
c = boolOrC; // C
|
||||
}
|
||||
|
||||
// Narrowing occurs only if target type is a subtype of variable type
|
||||
if (typeof strOrNum === "boolean") {
|
||||
var z1: string | number = strOrNum; // string | number
|
||||
let z1: {} = strOrNum; // {}
|
||||
}
|
||||
else {
|
||||
var z2: string | number = strOrNum; // string | number
|
||||
let z2: string | number = strOrNum; // string | number
|
||||
}
|
||||
|
||||
|
||||
@ -78,10 +77,9 @@ else {
|
||||
bool = boolOrC; // boolean
|
||||
}
|
||||
|
||||
// Narrowing occurs only if target type is a subtype of variable type
|
||||
if (typeof strOrNum !== "boolean") {
|
||||
var z1: string | number = strOrNum; // string | number
|
||||
let z1: string | number = strOrNum; // string | number
|
||||
}
|
||||
else {
|
||||
var z2: string | number = strOrNum; // string | number
|
||||
let z2: {} = strOrNum; // {}
|
||||
}
|
||||
|
||||
@ -41,12 +41,11 @@ else {
|
||||
c = numOrC; // C
|
||||
}
|
||||
|
||||
// Narrowing occurs only if target type is a subtype of variable type
|
||||
if (typeof strOrBool === "number") {
|
||||
var y1: string | boolean = strOrBool; // string | boolean
|
||||
let y1: {} = strOrBool; // {}
|
||||
}
|
||||
else {
|
||||
var y2: string | boolean = strOrBool; // string | boolean
|
||||
let y2: string | boolean = strOrBool; // string | boolean
|
||||
}
|
||||
|
||||
// A type guard of the form typeof x !== s, where s is a string literal,
|
||||
@ -77,10 +76,9 @@ else {
|
||||
num = numOrC; // number
|
||||
}
|
||||
|
||||
// Narrowing occurs only if target type is a subtype of variable type
|
||||
if (typeof strOrBool !== "number") {
|
||||
var y1: string | boolean = strOrBool; // string | boolean
|
||||
let y1: string | boolean = strOrBool; // string | boolean
|
||||
}
|
||||
else {
|
||||
var y2: string | boolean = strOrBool; // string | boolean
|
||||
let y2: {} = strOrBool; // {}
|
||||
}
|
||||
|
||||
@ -37,12 +37,11 @@ else {
|
||||
var r4: boolean = boolOrC; // boolean
|
||||
}
|
||||
|
||||
// Narrowing occurs only if target type is a subtype of variable type
|
||||
if (typeof strOrNumOrBool === "Object") {
|
||||
var q1: string | number | boolean = strOrNumOrBool; // string | number | boolean
|
||||
let q1: {} = strOrNumOrBool; // {}
|
||||
}
|
||||
else {
|
||||
var q2: string | number | boolean = strOrNumOrBool; // string | number | boolean
|
||||
let q2: string | number | boolean = strOrNumOrBool; // string | number | boolean
|
||||
}
|
||||
|
||||
// A type guard of the form typeof x !== s, where s is a string literal,
|
||||
@ -67,10 +66,9 @@ else {
|
||||
c = boolOrC; // C
|
||||
}
|
||||
|
||||
// Narrowing occurs only if target type is a subtype of variable type
|
||||
if (typeof strOrNumOrBool !== "Object") {
|
||||
var q1: string | number | boolean = strOrNumOrBool; // string | number | boolean
|
||||
let q1: string | number | boolean = strOrNumOrBool; // string | number | boolean
|
||||
}
|
||||
else {
|
||||
var q2: string | number | boolean = strOrNumOrBool; // string | number | boolean
|
||||
let q2: {} = strOrNumOrBool; // {}
|
||||
}
|
||||
|
||||
@ -41,12 +41,11 @@ else {
|
||||
c = strOrC; // C
|
||||
}
|
||||
|
||||
// Narrowing occurs only if target type is a subtype of variable type
|
||||
if (typeof numOrBool === "string") {
|
||||
var x1: number | boolean = numOrBool; // number | boolean
|
||||
let x1: {} = numOrBool; // {}
|
||||
}
|
||||
else {
|
||||
var x2: number | boolean = numOrBool; // number | boolean
|
||||
let x2: number | boolean = numOrBool; // number | boolean
|
||||
}
|
||||
|
||||
// A type guard of the form typeof x !== s, where s is a string literal,
|
||||
@ -77,10 +76,9 @@ else {
|
||||
str = strOrC; // string
|
||||
}
|
||||
|
||||
// Narrowing occurs only if target type is a subtype of variable type
|
||||
if (typeof numOrBool !== "string") {
|
||||
var x1: number | boolean = numOrBool; // number | boolean
|
||||
let x1: number | boolean = numOrBool; // number | boolean
|
||||
}
|
||||
else {
|
||||
var x2: number | boolean = numOrBool; // number | boolean
|
||||
let x2: {} = numOrBool; // {}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user