diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfBoolean.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfBoolean.ts index fb699ce8ce0..37651071b7f 100644 --- a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfBoolean.ts +++ b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfBoolean.ts @@ -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; // {} } diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNumber.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNumber.ts index 2868b114077..b4cdf81660e 100644 --- a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNumber.ts +++ b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNumber.ts @@ -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; // {} } diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfOther.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfOther.ts index ac3403d8151..44b064c3219 100644 --- a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfOther.ts +++ b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfOther.ts @@ -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; // {} } diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfString.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfString.ts index a356858e6c8..f742124708f 100644 --- a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfString.ts +++ b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfString.ts @@ -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; // {} }