mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-12 20:25:48 -06:00
Merge pull request #13791 from Microsoft/typeof-string-literal-union-type
`typeof x` now has a string literal union type
This commit is contained in:
commit
363d91425e
@ -326,7 +326,6 @@ namespace ts {
|
||||
"object": TypeFacts.TypeofEQObject,
|
||||
"function": TypeFacts.TypeofEQFunction
|
||||
});
|
||||
|
||||
const typeofNEFacts = createMapFromTemplate({
|
||||
"string": TypeFacts.TypeofNEString,
|
||||
"number": TypeFacts.TypeofNENumber,
|
||||
@ -336,7 +335,6 @@ namespace ts {
|
||||
"object": TypeFacts.TypeofNEObject,
|
||||
"function": TypeFacts.TypeofNEFunction
|
||||
});
|
||||
|
||||
const typeofTypesByName = createMapFromTemplate<Type>({
|
||||
"string": stringType,
|
||||
"number": numberType,
|
||||
@ -344,6 +342,7 @@ namespace ts {
|
||||
"symbol": esSymbolType,
|
||||
"undefined": undefinedType
|
||||
});
|
||||
const typeofType = createTypeofType();
|
||||
|
||||
let jsxElementType: Type;
|
||||
let _jsxNamespace: string;
|
||||
@ -1727,6 +1726,10 @@ namespace ts {
|
||||
return type;
|
||||
}
|
||||
|
||||
function createTypeofType() {
|
||||
return getUnionType(convertToArray(typeofEQFacts.keys(), s => getLiteralTypeForText(TypeFlags.StringLiteral, s)));
|
||||
}
|
||||
|
||||
// A reserved member name starts with two underscores, but the third character cannot be an underscore
|
||||
// or the @ symbol. A third underscore indicates an escaped form of an identifer that started
|
||||
// with at least two underscores. The @ character indicates that the name is denoted by a well known ES
|
||||
@ -14626,7 +14629,7 @@ namespace ts {
|
||||
|
||||
function checkTypeOfExpression(node: TypeOfExpression): Type {
|
||||
checkExpression(node.expression);
|
||||
return stringType;
|
||||
return typeofType;
|
||||
}
|
||||
|
||||
function checkVoidExpression(node: VoidExpression): Type {
|
||||
|
||||
@ -895,6 +895,14 @@ namespace ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
export function convertToArray<T, U>(iterator: Iterator<T>, f: (value: T) => U) {
|
||||
const result: U[] = [];
|
||||
for (let { value, done } = iterator.next(); !done; { value, done } = iterator.next()) {
|
||||
result.push(f(value));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls `callback` for each entry in the map, returning the first truthy result.
|
||||
* Use `map.forEach` instead for normal iteration.
|
||||
|
||||
@ -12,7 +12,7 @@ function f1(x: Color | string) {
|
||||
|
||||
if (typeof x === "number") {
|
||||
>typeof x === "number" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | Color
|
||||
>"number" : "number"
|
||||
|
||||
@ -41,7 +41,7 @@ function f2(x: Color | string | string[]) {
|
||||
|
||||
if (typeof x === "object") {
|
||||
>typeof x === "object" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | Color | string[]
|
||||
>"object" : "object"
|
||||
|
||||
@ -54,7 +54,7 @@ function f2(x: Color | string | string[]) {
|
||||
}
|
||||
if (typeof x === "number") {
|
||||
>typeof x === "number" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | Color | string[]
|
||||
>"number" : "number"
|
||||
|
||||
@ -76,7 +76,7 @@ function f2(x: Color | string | string[]) {
|
||||
}
|
||||
if (typeof x === "string") {
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | Color | string[]
|
||||
>"string" : "string"
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ function f() {
|
||||
|
||||
return typeof class {} === "function";
|
||||
>typeof class {} === "function" : boolean
|
||||
>typeof class {} : string
|
||||
>typeof class {} : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>class {} : typeof (Anonymous class)
|
||||
>"function" : "function"
|
||||
}
|
||||
|
||||
@ -103,17 +103,17 @@ var r6 = foo6(1);
|
||||
>1 : 1
|
||||
|
||||
function foo7(x) {
|
||||
>foo7 : (x: any) => string
|
||||
>foo7 : (x: any) => "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : any
|
||||
|
||||
return typeof x;
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : any
|
||||
}
|
||||
var r7 = foo7(1);
|
||||
>r7 : string
|
||||
>foo7(1) : string
|
||||
>foo7 : (x: any) => string
|
||||
>r7 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>foo7(1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>foo7 : (x: any) => "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>1 : 1
|
||||
|
||||
// object types
|
||||
|
||||
@ -182,7 +182,7 @@ declare var A;
|
||||
>(<any>typeof A).x : any
|
||||
>(<any>typeof A) : any
|
||||
><any>typeof A : any
|
||||
>typeof A : string
|
||||
>typeof A : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>A : any
|
||||
>x : any
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ async function f() {
|
||||
>0 : 0
|
||||
|
||||
typeof await 0;
|
||||
>typeof await 0 : string
|
||||
>typeof await 0 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>await 0 : 0
|
||||
>0 : 0
|
||||
|
||||
@ -21,7 +21,7 @@ async function f() {
|
||||
>await void <string> typeof <number> void await 0 : any
|
||||
>void <string> typeof <number> void await 0 : undefined
|
||||
><string> typeof <number> void await 0 : string
|
||||
>typeof <number> void await 0 : string
|
||||
>typeof <number> void await 0 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
><number> void await 0 : number
|
||||
>void await 0 : undefined
|
||||
>await 0 : 0
|
||||
|
||||
@ -5,7 +5,7 @@ var x: StringTree;
|
||||
|
||||
if (typeof x !== "string") {
|
||||
>typeof x !== "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : StringTree
|
||||
>"string" : "string"
|
||||
|
||||
|
||||
@ -120,7 +120,7 @@ true ? exprString1 : exprBoolean1; // union
|
||||
typeof "123" == "string" ? exprBoolean1 : exprBoolean2;
|
||||
>typeof "123" == "string" ? exprBoolean1 : exprBoolean2 : boolean
|
||||
>typeof "123" == "string" : boolean
|
||||
>typeof "123" : string
|
||||
>typeof "123" : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>"123" : "123"
|
||||
>"string" : "string"
|
||||
>exprBoolean1 : boolean
|
||||
@ -262,7 +262,7 @@ var resultIsBoolean3 = typeof "123" == "string" ? exprBoolean1 : exprBoolean2;
|
||||
>resultIsBoolean3 : boolean
|
||||
>typeof "123" == "string" ? exprBoolean1 : exprBoolean2 : boolean
|
||||
>typeof "123" == "string" : boolean
|
||||
>typeof "123" : string
|
||||
>typeof "123" : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>"123" : "123"
|
||||
>"string" : "string"
|
||||
>exprBoolean1 : boolean
|
||||
@ -299,7 +299,7 @@ var resultIsStringOrBoolean4 = typeof "123" === "string" ? exprString1 : exprBoo
|
||||
>resultIsStringOrBoolean4 : string | boolean
|
||||
>typeof "123" === "string" ? exprString1 : exprBoolean1 : string | boolean
|
||||
>typeof "123" === "string" : boolean
|
||||
>typeof "123" : string
|
||||
>typeof "123" : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>"123" : "123"
|
||||
>"string" : "string"
|
||||
>exprString1 : string
|
||||
|
||||
@ -123,7 +123,7 @@ var array = ["1", "2", "3"];
|
||||
|
||||
typeof condString ? exprAny1 : exprAny2;
|
||||
>typeof condString ? exprAny1 : exprAny2 : any
|
||||
>typeof condString : string
|
||||
>typeof condString : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>condString : string
|
||||
>exprAny1 : any
|
||||
>exprAny2 : any
|
||||
@ -254,7 +254,7 @@ var resultIsStringOrBoolean2 = "hello" ? exprString1 : exprBoolean1; // union
|
||||
var resultIsAny3 = typeof condString ? exprAny1 : exprAny2;
|
||||
>resultIsAny3 : any
|
||||
>typeof condString ? exprAny1 : exprAny2 : any
|
||||
>typeof condString : string
|
||||
>typeof condString : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>condString : string
|
||||
>exprAny1 : any
|
||||
>exprAny2 : any
|
||||
@ -297,7 +297,7 @@ var resultIsObject3 = array[1] ? exprIsObject1 : exprIsObject2;
|
||||
var resultIsStringOrBoolean3 = typeof condString ? exprString1 : exprBoolean1; // union
|
||||
>resultIsStringOrBoolean3 : string | boolean
|
||||
>typeof condString ? exprString1 : exprBoolean1 : string | boolean
|
||||
>typeof condString : string
|
||||
>typeof condString : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>condString : string
|
||||
>exprString1 : string
|
||||
>exprBoolean1 : boolean
|
||||
|
||||
@ -12,7 +12,7 @@ function f1() {
|
||||
|
||||
if (typeof x === "string") {
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
|
||||
@ -35,7 +35,7 @@ function f2() {
|
||||
|
||||
if (typeof x !== "string") {
|
||||
>typeof x !== "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
|
||||
@ -59,7 +59,7 @@ function f3() {
|
||||
|
||||
if (typeof x === "string") {
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
|
||||
@ -82,7 +82,7 @@ function f4() {
|
||||
|
||||
if (typeof x !== "string") {
|
||||
>typeof x !== "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
|
||||
@ -106,7 +106,7 @@ function f5() {
|
||||
|
||||
if (typeof x === "string") {
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ function f(x: string | number | boolean) {
|
||||
>y : string | number | boolean
|
||||
>"" : ""
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number | boolean
|
||||
>"string" : "string"
|
||||
|
||||
@ -36,7 +36,7 @@ function f(x: string | number | boolean) {
|
||||
>z : string | number | boolean
|
||||
>1 : 1
|
||||
>typeof x === "number" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : number | boolean
|
||||
>"number" : "number"
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ function c() {
|
||||
|
||||
if (typeof x === "string") continue;
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
|
||||
|
||||
@ -82,7 +82,7 @@ function d() {
|
||||
>x : string | number | boolean
|
||||
>"" : ""
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
>x = 5 : 5
|
||||
@ -107,7 +107,7 @@ function e() {
|
||||
>"" : ""
|
||||
>0 : 0
|
||||
>typeof x !== "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : number | true
|
||||
>"string" : "string"
|
||||
>x = "" || true : true
|
||||
@ -128,7 +128,7 @@ function f() {
|
||||
|
||||
for (; typeof x !== "string";) {
|
||||
>typeof x !== "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number | boolean
|
||||
>"string" : "string"
|
||||
|
||||
@ -137,7 +137,7 @@ function f() {
|
||||
|
||||
if (typeof x === "number") break;
|
||||
>typeof x === "number" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : number | boolean
|
||||
>"number" : "number"
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ function f1() {
|
||||
|
||||
if (typeof x === "string") {
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
|
||||
@ -41,7 +41,7 @@ function f2() {
|
||||
|
||||
if (typeof x === "string") {
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
|
||||
@ -73,7 +73,7 @@ function f3() {
|
||||
|
||||
if (typeof x === "string") {
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
|
||||
|
||||
@ -100,7 +100,7 @@ function c<T>(data: string | T): T {
|
||||
|
||||
if (typeof data === 'string') {
|
||||
>typeof data === 'string' : boolean
|
||||
>typeof data : string
|
||||
>typeof data : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>data : string | T
|
||||
>'string' : "string"
|
||||
|
||||
@ -124,7 +124,7 @@ function d<T extends string>(data: string | T): never {
|
||||
|
||||
if (typeof data === 'string') {
|
||||
>typeof data === 'string' : boolean
|
||||
>typeof data : string
|
||||
>typeof data : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>data : string | T
|
||||
>'string' : "string"
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ function c() {
|
||||
|
||||
if (typeof x === "string") continue;
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ function foo1() {
|
||||
|
||||
if (typeof x === "string") {
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
|
||||
@ -49,7 +49,7 @@ function foo2() {
|
||||
|
||||
if (typeof x === "number") {
|
||||
>typeof x === "number" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"number" : "number"
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ export function f(x: any): x is number {
|
||||
|
||||
return typeof x === "number";
|
||||
>typeof x === "number" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : any
|
||||
>"number" : "number"
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ function f1(x: Foo | Bar | string) {
|
||||
|
||||
if (typeof x !== 'string') {
|
||||
>typeof x !== 'string' : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | Foo | Bar
|
||||
>'string' : "string"
|
||||
|
||||
@ -58,7 +58,7 @@ function f2(x: Foo | Bar | string | undefined) {
|
||||
|
||||
if (typeof x === "object") {
|
||||
>typeof x === "object" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | Foo | Bar | undefined
|
||||
>"object" : "object"
|
||||
|
||||
@ -89,7 +89,7 @@ function f3(x: Foo | Bar | string | null) {
|
||||
>x && typeof x !== "string" : boolean | "" | null
|
||||
>x : string | Foo | Bar | null
|
||||
>typeof x !== "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | Foo | Bar
|
||||
>"string" : "string"
|
||||
|
||||
@ -120,7 +120,7 @@ function f4(x: Foo | Bar | string | number | null) {
|
||||
>x && typeof x === "object" : boolean | "" | 0 | null
|
||||
>x : string | number | Foo | Bar | null
|
||||
>typeof x === "object" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number | Foo | Bar
|
||||
>"object" : "object"
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ var s;
|
||||
|
||||
`${typeof (t1 ** t2 ** t1) } world`;
|
||||
>`${typeof (t1 ** t2 ** t1) } world` : string
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
@ -162,14 +162,14 @@ var s;
|
||||
|
||||
`${typeof (t1 ** t2 ** t1)} hello world ${typeof (t1 ** t2 ** t1)}`;
|
||||
>`${typeof (t1 ** t2 ** t1)} hello world ${typeof (t1 ** t2 ** t1)}` : string
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
>t2 ** t1 : number
|
||||
>t2 : number
|
||||
>t1 : number
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
@ -223,7 +223,7 @@ var s;
|
||||
|
||||
`hello ${typeof (t1 ** t2 ** t1)}`;
|
||||
>`hello ${typeof (t1 ** t2 ** t1)}` : string
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
|
||||
@ -64,7 +64,7 @@ var s;
|
||||
|
||||
`${typeof (t1 ** t2 ** t1) } world`;
|
||||
>`${typeof (t1 ** t2 ** t1) } world` : string
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
@ -162,14 +162,14 @@ var s;
|
||||
|
||||
`${typeof (t1 ** t2 ** t1)} hello world ${typeof (t1 ** t2 ** t1)}`;
|
||||
>`${typeof (t1 ** t2 ** t1)} hello world ${typeof (t1 ** t2 ** t1)}` : string
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
>t2 ** t1 : number
|
||||
>t2 : number
|
||||
>t1 : number
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
@ -223,7 +223,7 @@ var s;
|
||||
|
||||
`hello ${typeof (t1 ** t2 ** t1)}`;
|
||||
>`hello ${typeof (t1 ** t2 ** t1)}` : string
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
|
||||
@ -54,7 +54,7 @@ var s;
|
||||
|
||||
`${typeof (t1 ** t2 ** t1) }`;
|
||||
>`${typeof (t1 ** t2 ** t1) }` : string
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
@ -66,7 +66,7 @@ var s;
|
||||
>`${1 + typeof (t1 ** t2 ** t1) }` : string
|
||||
>1 + typeof (t1 ** t2 ** t1) : string
|
||||
>1 : 1
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
@ -141,14 +141,14 @@ var s;
|
||||
|
||||
`${typeof (t1 ** t2 ** t1)}${typeof (t1 ** t2 ** t1)}`;
|
||||
>`${typeof (t1 ** t2 ** t1)}${typeof (t1 ** t2 ** t1)}` : string
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
>t2 ** t1 : number
|
||||
>t2 : number
|
||||
>t1 : number
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
@ -223,14 +223,14 @@ var s;
|
||||
|
||||
`${typeof (t1 ** t2 ** t1) } hello world ${typeof (t1 ** t2 ** t1) }`;
|
||||
>`${typeof (t1 ** t2 ** t1) } hello world ${typeof (t1 ** t2 ** t1) }` : string
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
>t2 ** t1 : number
|
||||
>t2 : number
|
||||
>t1 : number
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
|
||||
@ -54,7 +54,7 @@ var s;
|
||||
|
||||
`${typeof (t1 ** t2 ** t1) }`;
|
||||
>`${typeof (t1 ** t2 ** t1) }` : string
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
@ -66,7 +66,7 @@ var s;
|
||||
>`${1 + typeof (t1 ** t2 ** t1) }` : string
|
||||
>1 + typeof (t1 ** t2 ** t1) : string
|
||||
>1 : 1
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
@ -141,14 +141,14 @@ var s;
|
||||
|
||||
`${typeof (t1 ** t2 ** t1)}${typeof (t1 ** t2 ** t1)}`;
|
||||
>`${typeof (t1 ** t2 ** t1)}${typeof (t1 ** t2 ** t1)}` : string
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
>t2 ** t1 : number
|
||||
>t2 : number
|
||||
>t1 : number
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
@ -223,14 +223,14 @@ var s;
|
||||
|
||||
`${typeof (t1 ** t2 ** t1) } hello world ${typeof (t1 ** t2 ** t1) }`;
|
||||
>`${typeof (t1 ** t2 ** t1) } hello world ${typeof (t1 ** t2 ** t1) }` : string
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
>t2 ** t1 : number
|
||||
>t2 : number
|
||||
>t1 : number
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
|
||||
@ -54,7 +54,7 @@ var s;
|
||||
|
||||
`hello ${typeof (t1 ** t2 ** t1) }`;
|
||||
>`hello ${typeof (t1 ** t2 ** t1) }` : string
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
@ -66,7 +66,7 @@ var s;
|
||||
>`hello ${1 + typeof (t1 ** t2 ** t1) }` : string
|
||||
>1 + typeof (t1 ** t2 ** t1) : string
|
||||
>1 : 1
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
@ -141,14 +141,14 @@ var s;
|
||||
|
||||
`hello ${typeof (t1 ** t2 ** t1) }${typeof (t1 ** t2 ** t1) }`;
|
||||
>`hello ${typeof (t1 ** t2 ** t1) }${typeof (t1 ** t2 ** t1) }` : string
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
>t2 ** t1 : number
|
||||
>t2 : number
|
||||
>t1 : number
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
@ -223,14 +223,14 @@ var s;
|
||||
|
||||
`hello ${typeof (t1 ** t2 ** t1) } hello world ${typeof (t1 ** t2 ** t1) }`;
|
||||
>`hello ${typeof (t1 ** t2 ** t1) } hello world ${typeof (t1 ** t2 ** t1) }` : string
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
>t2 ** t1 : number
|
||||
>t2 : number
|
||||
>t1 : number
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
|
||||
@ -54,7 +54,7 @@ var s;
|
||||
|
||||
`hello ${typeof (t1 ** t2 ** t1) }`;
|
||||
>`hello ${typeof (t1 ** t2 ** t1) }` : string
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
@ -66,7 +66,7 @@ var s;
|
||||
>`hello ${1 + typeof (t1 ** t2 ** t1) }` : string
|
||||
>1 + typeof (t1 ** t2 ** t1) : string
|
||||
>1 : 1
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
@ -141,14 +141,14 @@ var s;
|
||||
|
||||
`hello ${typeof (t1 ** t2 ** t1) }${typeof (t1 ** t2 ** t1) }`;
|
||||
>`hello ${typeof (t1 ** t2 ** t1) }${typeof (t1 ** t2 ** t1) }` : string
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
>t2 ** t1 : number
|
||||
>t2 : number
|
||||
>t1 : number
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
@ -223,14 +223,14 @@ var s;
|
||||
|
||||
`hello ${typeof (t1 ** t2 ** t1) } hello world ${typeof (t1 ** t2 ** t1) }`;
|
||||
>`hello ${typeof (t1 ** t2 ** t1) } hello world ${typeof (t1 ** t2 ** t1) }` : string
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
>t2 ** t1 : number
|
||||
>t2 : number
|
||||
>t1 : number
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
|
||||
@ -54,7 +54,7 @@ var s;
|
||||
|
||||
`${typeof (t1 ** t2 ** t1) } world`;
|
||||
>`${typeof (t1 ** t2 ** t1) } world` : string
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
@ -66,7 +66,7 @@ var s;
|
||||
>`${1 + typeof (t1 ** t2 ** t1) } world` : string
|
||||
>1 + typeof (t1 ** t2 ** t1) : string
|
||||
>1 : 1
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
@ -141,14 +141,14 @@ var s;
|
||||
|
||||
`${typeof (t1 ** t2 ** t1) }${typeof (t1 ** t2 ** t1) } world`;
|
||||
>`${typeof (t1 ** t2 ** t1) }${typeof (t1 ** t2 ** t1) } world` : string
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
>t2 ** t1 : number
|
||||
>t2 : number
|
||||
>t1 : number
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
@ -223,14 +223,14 @@ var s;
|
||||
|
||||
`${typeof (t1 ** t2 ** t1) } hello world ${typeof (t1 ** t2 ** t1)} !!`;
|
||||
>`${typeof (t1 ** t2 ** t1) } hello world ${typeof (t1 ** t2 ** t1)} !!` : string
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
>t2 ** t1 : number
|
||||
>t2 : number
|
||||
>t1 : number
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
|
||||
@ -54,7 +54,7 @@ var s;
|
||||
|
||||
`${typeof (t1 ** t2 ** t1) } world`;
|
||||
>`${typeof (t1 ** t2 ** t1) } world` : string
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
@ -66,7 +66,7 @@ var s;
|
||||
>`${1 + typeof (t1 ** t2 ** t1) } world` : string
|
||||
>1 + typeof (t1 ** t2 ** t1) : string
|
||||
>1 : 1
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
@ -141,14 +141,14 @@ var s;
|
||||
|
||||
`${typeof (t1 ** t2 ** t1) }${typeof (t1 ** t2 ** t1) } world`;
|
||||
>`${typeof (t1 ** t2 ** t1) }${typeof (t1 ** t2 ** t1) } world` : string
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
>t2 ** t1 : number
|
||||
>t2 : number
|
||||
>t1 : number
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
@ -223,14 +223,14 @@ var s;
|
||||
|
||||
`${typeof (t1 ** t2 ** t1) } hello world ${typeof (t1 ** t2 ** t1)} !!`;
|
||||
>`${typeof (t1 ** t2 ** t1) } hello world ${typeof (t1 ** t2 ** t1)} !!` : string
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
>t2 ** t1 : number
|
||||
>t2 : number
|
||||
>t1 : number
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>typeof (t1 ** t2 ** t1) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
|
||||
@ -5,7 +5,7 @@ var x: StringTree;
|
||||
|
||||
if (typeof x !== "string") {
|
||||
>typeof x !== "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : StringTree
|
||||
>"string" : "string"
|
||||
|
||||
|
||||
@ -227,9 +227,9 @@ function getValueAsString(value: IntersectionFail): string {
|
||||
|
||||
if (value.kind === 'int') {
|
||||
>value.kind === 'int' : boolean
|
||||
>value.kind : "int" | "string"
|
||||
>value.kind : "string" | "int"
|
||||
>value : IntersectionFail
|
||||
>kind : "int" | "string"
|
||||
>kind : "string" | "int"
|
||||
>'int' : "int"
|
||||
|
||||
return '' + value.num;
|
||||
|
||||
@ -29,7 +29,7 @@ function boxify<T>(obj: T): Boxified<T> {
|
||||
|
||||
if (typeof obj === "object") {
|
||||
>typeof obj === "object" : boolean
|
||||
>typeof obj : string
|
||||
>typeof obj : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>obj : T
|
||||
>"object" : "object"
|
||||
|
||||
|
||||
@ -3,9 +3,9 @@
|
||||
for (const element of document.getElementsByTagName("a")) {
|
||||
>element : HTMLAnchorElement
|
||||
>document.getElementsByTagName("a") : NodeListOf<HTMLAnchorElement>
|
||||
>document.getElementsByTagName : { <K extends "a" | "abbr" | "acronym" | "address" | "applet" | "area" | "article" | "aside" | "audio" | "b" | "base" | "basefont" | "bdo" | "big" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "center" | "circle" | "cite" | "clippath" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "defs" | "del" | "desc" | "dfn" | "dir" | "div" | "dl" | "dt" | "ellipse" | "em" | "embed" | "feblend" | "fecolormatrix" | "fecomponenttransfer" | "fecomposite" | "feconvolvematrix" | "fediffuselighting" | "fedisplacementmap" | "fedistantlight" | "feflood" | "fefunca" | "fefuncb" | "fefuncg" | "fefuncr" | "fegaussianblur" | "feimage" | "femerge" | "femergenode" | "femorphology" | "feoffset" | "fepointlight" | "fespecularlighting" | "fespotlight" | "fetile" | "feturbulence" | "fieldset" | "figcaption" | "figure" | "filter" | "font" | "footer" | "foreignobject" | "form" | "frame" | "frameset" | "g" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "image" | "img" | "input" | "ins" | "isindex" | "kbd" | "keygen" | "label" | "legend" | "li" | "line" | "lineargradient" | "link" | "listing" | "map" | "mark" | "marker" | "marquee" | "mask" | "menu" | "meta" | "metadata" | "meter" | "nav" | "nextid" | "nobr" | "noframes" | "noscript" | "object" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "path" | "pattern" | "picture" | "plaintext" | "polygon" | "polyline" | "pre" | "progress" | "q" | "radialgradient" | "rect" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "small" | "source" | "span" | "stop" | "strike" | "strong" | "style" | "sub" | "sup" | "svg" | "switch" | "symbol" | "table" | "tbody" | "td" | "template" | "text" | "textpath" | "textarea" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "track" | "tspan" | "tt" | "u" | "ul" | "use" | "var" | "video" | "view" | "wbr" | "x-ms-webview" | "xmp">(tagname: K): ElementListTagNameMap[K]; (tagname: string): NodeListOf<Element>; }
|
||||
>document.getElementsByTagName : { <K extends "symbol" | "object" | "a" | "abbr" | "acronym" | "address" | "applet" | "area" | "article" | "aside" | "audio" | "b" | "base" | "basefont" | "bdo" | "big" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "center" | "circle" | "cite" | "clippath" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "defs" | "del" | "desc" | "dfn" | "dir" | "div" | "dl" | "dt" | "ellipse" | "em" | "embed" | "feblend" | "fecolormatrix" | "fecomponenttransfer" | "fecomposite" | "feconvolvematrix" | "fediffuselighting" | "fedisplacementmap" | "fedistantlight" | "feflood" | "fefunca" | "fefuncb" | "fefuncg" | "fefuncr" | "fegaussianblur" | "feimage" | "femerge" | "femergenode" | "femorphology" | "feoffset" | "fepointlight" | "fespecularlighting" | "fespotlight" | "fetile" | "feturbulence" | "fieldset" | "figcaption" | "figure" | "filter" | "font" | "footer" | "foreignobject" | "form" | "frame" | "frameset" | "g" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "image" | "img" | "input" | "ins" | "isindex" | "kbd" | "keygen" | "label" | "legend" | "li" | "line" | "lineargradient" | "link" | "listing" | "map" | "mark" | "marker" | "marquee" | "mask" | "menu" | "meta" | "metadata" | "meter" | "nav" | "nextid" | "nobr" | "noframes" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "path" | "pattern" | "picture" | "plaintext" | "polygon" | "polyline" | "pre" | "progress" | "q" | "radialgradient" | "rect" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "small" | "source" | "span" | "stop" | "strike" | "strong" | "style" | "sub" | "sup" | "svg" | "switch" | "table" | "tbody" | "td" | "template" | "text" | "textpath" | "textarea" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "track" | "tspan" | "tt" | "u" | "ul" | "use" | "var" | "video" | "view" | "wbr" | "x-ms-webview" | "xmp">(tagname: K): ElementListTagNameMap[K]; (tagname: string): NodeListOf<Element>; }
|
||||
>document : Document
|
||||
>getElementsByTagName : { <K extends "a" | "abbr" | "acronym" | "address" | "applet" | "area" | "article" | "aside" | "audio" | "b" | "base" | "basefont" | "bdo" | "big" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "center" | "circle" | "cite" | "clippath" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "defs" | "del" | "desc" | "dfn" | "dir" | "div" | "dl" | "dt" | "ellipse" | "em" | "embed" | "feblend" | "fecolormatrix" | "fecomponenttransfer" | "fecomposite" | "feconvolvematrix" | "fediffuselighting" | "fedisplacementmap" | "fedistantlight" | "feflood" | "fefunca" | "fefuncb" | "fefuncg" | "fefuncr" | "fegaussianblur" | "feimage" | "femerge" | "femergenode" | "femorphology" | "feoffset" | "fepointlight" | "fespecularlighting" | "fespotlight" | "fetile" | "feturbulence" | "fieldset" | "figcaption" | "figure" | "filter" | "font" | "footer" | "foreignobject" | "form" | "frame" | "frameset" | "g" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "image" | "img" | "input" | "ins" | "isindex" | "kbd" | "keygen" | "label" | "legend" | "li" | "line" | "lineargradient" | "link" | "listing" | "map" | "mark" | "marker" | "marquee" | "mask" | "menu" | "meta" | "metadata" | "meter" | "nav" | "nextid" | "nobr" | "noframes" | "noscript" | "object" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "path" | "pattern" | "picture" | "plaintext" | "polygon" | "polyline" | "pre" | "progress" | "q" | "radialgradient" | "rect" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "small" | "source" | "span" | "stop" | "strike" | "strong" | "style" | "sub" | "sup" | "svg" | "switch" | "symbol" | "table" | "tbody" | "td" | "template" | "text" | "textpath" | "textarea" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "track" | "tspan" | "tt" | "u" | "ul" | "use" | "var" | "video" | "view" | "wbr" | "x-ms-webview" | "xmp">(tagname: K): ElementListTagNameMap[K]; (tagname: string): NodeListOf<Element>; }
|
||||
>getElementsByTagName : { <K extends "symbol" | "object" | "a" | "abbr" | "acronym" | "address" | "applet" | "area" | "article" | "aside" | "audio" | "b" | "base" | "basefont" | "bdo" | "big" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "center" | "circle" | "cite" | "clippath" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "defs" | "del" | "desc" | "dfn" | "dir" | "div" | "dl" | "dt" | "ellipse" | "em" | "embed" | "feblend" | "fecolormatrix" | "fecomponenttransfer" | "fecomposite" | "feconvolvematrix" | "fediffuselighting" | "fedisplacementmap" | "fedistantlight" | "feflood" | "fefunca" | "fefuncb" | "fefuncg" | "fefuncr" | "fegaussianblur" | "feimage" | "femerge" | "femergenode" | "femorphology" | "feoffset" | "fepointlight" | "fespecularlighting" | "fespotlight" | "fetile" | "feturbulence" | "fieldset" | "figcaption" | "figure" | "filter" | "font" | "footer" | "foreignobject" | "form" | "frame" | "frameset" | "g" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "image" | "img" | "input" | "ins" | "isindex" | "kbd" | "keygen" | "label" | "legend" | "li" | "line" | "lineargradient" | "link" | "listing" | "map" | "mark" | "marker" | "marquee" | "mask" | "menu" | "meta" | "metadata" | "meter" | "nav" | "nextid" | "nobr" | "noframes" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "path" | "pattern" | "picture" | "plaintext" | "polygon" | "polyline" | "pre" | "progress" | "q" | "radialgradient" | "rect" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "small" | "source" | "span" | "stop" | "strike" | "strong" | "style" | "sub" | "sup" | "svg" | "switch" | "table" | "tbody" | "td" | "template" | "text" | "textpath" | "textarea" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "track" | "tspan" | "tt" | "u" | "ul" | "use" | "var" | "video" | "view" | "wbr" | "x-ms-webview" | "xmp">(tagname: K): ElementListTagNameMap[K]; (tagname: string): NodeListOf<Element>; }
|
||||
>"a" : "a"
|
||||
|
||||
element.href;
|
||||
|
||||
@ -17,7 +17,7 @@ function isPet(pet: any): pet is Pet {
|
||||
|
||||
return typeof pet.name === "string";
|
||||
>typeof pet.name === "string" : boolean
|
||||
>typeof pet.name : string
|
||||
>typeof pet.name : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>pet.name : any
|
||||
>pet : any
|
||||
>name : any
|
||||
|
||||
@ -9,7 +9,7 @@ function f1() {
|
||||
|
||||
if (typeof a !== 'boolean') {
|
||||
>typeof a !== 'boolean' : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : string | number | boolean
|
||||
>'boolean' : "boolean"
|
||||
|
||||
@ -34,7 +34,7 @@ function f1() {
|
||||
|
||||
if (typeof a === 'string') {
|
||||
>typeof a === 'string' : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : string | number
|
||||
>'string' : "string"
|
||||
|
||||
@ -66,7 +66,7 @@ function f2() {
|
||||
|
||||
if (typeof a === 'string') {
|
||||
>typeof a === 'string' : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : string | number
|
||||
>'string' : "string"
|
||||
|
||||
@ -78,7 +78,7 @@ function f2() {
|
||||
|
||||
if (typeof a === 'string') {
|
||||
>typeof a === 'string' : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : string
|
||||
>'string' : "string"
|
||||
|
||||
|
||||
@ -164,7 +164,7 @@ function f1(x: string | number) {
|
||||
|
||||
if (typeof x === "boolean") {
|
||||
>typeof x === "boolean" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -182,7 +182,7 @@ function f2(x: string | number) {
|
||||
|
||||
if (typeof x === "boolean") {
|
||||
>typeof x === "boolean" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"boolean" : "boolean"
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ module Bugs {
|
||||
return typeof args[index] !== 'undefined'
|
||||
>typeof args[index] !== 'undefined' ? args[index] : match : any
|
||||
>typeof args[index] !== 'undefined' : boolean
|
||||
>typeof args[index] : string
|
||||
>typeof args[index] : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>args[index] : any
|
||||
>args : any[]
|
||||
>index : any
|
||||
|
||||
@ -26,7 +26,7 @@ function attr(nameOrMap: any, value?: string): any {
|
||||
>nameOrMap && typeof nameOrMap === "object" : boolean
|
||||
>nameOrMap : any
|
||||
>typeof nameOrMap === "object" : boolean
|
||||
>typeof nameOrMap : string
|
||||
>typeof nameOrMap : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>nameOrMap : any
|
||||
>"object" : "object"
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ if (void x) {
|
||||
}
|
||||
|
||||
if (typeof x) {
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : false
|
||||
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ x;
|
||||
|
||||
if (typeof x === "symbol") {
|
||||
>typeof x === "symbol" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : symbol | Foo
|
||||
>"symbol" : "symbol"
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ x;
|
||||
|
||||
if (typeof x === "object") {
|
||||
>typeof x === "object" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : symbol | Foo
|
||||
>"object" : "object"
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ x;
|
||||
|
||||
if (typeof x === "number") {
|
||||
>typeof x === "number" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : symbol | E
|
||||
>"number" : "number"
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInTypeOf.ts ===
|
||||
var x = typeof `abc${ 123 }def`;
|
||||
>x : string
|
||||
>typeof `abc${ 123 }def` : string
|
||||
>x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>typeof `abc${ 123 }def` : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>`abc${ 123 }def` : string
|
||||
>123 : 123
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInTypeOfES6.ts ===
|
||||
var x = typeof `abc${ 123 }def`;
|
||||
>x : string
|
||||
>typeof `abc${ 123 }def` : string
|
||||
>x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>typeof `abc${ 123 }def` : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>`abc${ 123 }def` : string
|
||||
>123 : 123
|
||||
|
||||
|
||||
@ -2,6 +2,6 @@
|
||||
var x = `abc${ typeof "hi" }def`;
|
||||
>x : string
|
||||
>`abc${ typeof "hi" }def` : string
|
||||
>typeof "hi" : string
|
||||
>typeof "hi" : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>"hi" : "hi"
|
||||
|
||||
|
||||
@ -2,6 +2,6 @@
|
||||
var x = `abc${ typeof "hi" }def`;
|
||||
>x : string
|
||||
>`abc${ typeof "hi" }def` : string
|
||||
>typeof "hi" : string
|
||||
>typeof "hi" : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>"hi" : "hi"
|
||||
|
||||
|
||||
@ -174,7 +174,7 @@ throw aModule;
|
||||
>aModule : typeof M
|
||||
|
||||
throw typeof M;
|
||||
>typeof M : string
|
||||
>typeof M : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>M : typeof M
|
||||
|
||||
var aClassInModule = new M.A();
|
||||
|
||||
@ -12,7 +12,7 @@ let x: number|string|E|V;
|
||||
|
||||
if (typeof x === "number") {
|
||||
>typeof x === "number" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number | E | V
|
||||
>"number" : "number"
|
||||
|
||||
@ -26,7 +26,7 @@ else {
|
||||
|
||||
if (typeof x !== "number") {
|
||||
>typeof x !== "number" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number | E | V
|
||||
>"number" : "number"
|
||||
|
||||
|
||||
@ -163,7 +163,7 @@ function hasLegs(x: Beast): x is Legged { return x && typeof x.legs === 'number'
|
||||
>x && typeof x.legs === 'number' : boolean
|
||||
>x : Beast
|
||||
>typeof x.legs === 'number' : boolean
|
||||
>typeof x.legs : string
|
||||
>typeof x.legs : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x.legs : number | undefined
|
||||
>x : Beast
|
||||
>legs : number | undefined
|
||||
|
||||
@ -7,13 +7,13 @@ if ((typeof strOrBool === 'boolean' && !strOrBool) || typeof strOrBool === 'stri
|
||||
>(typeof strOrBool === 'boolean' && !strOrBool) : boolean
|
||||
>typeof strOrBool === 'boolean' && !strOrBool : boolean
|
||||
>typeof strOrBool === 'boolean' : boolean
|
||||
>typeof strOrBool : string
|
||||
>typeof strOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrBool : string | boolean
|
||||
>'boolean' : "boolean"
|
||||
>!strOrBool : boolean
|
||||
>strOrBool : boolean
|
||||
>typeof strOrBool === 'string' : boolean
|
||||
>typeof strOrBool : string
|
||||
>typeof strOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrBool : string | true
|
||||
>'string' : "string"
|
||||
|
||||
@ -22,7 +22,7 @@ if ((typeof strOrBool === 'boolean' && !strOrBool) || typeof strOrBool === 'stri
|
||||
>(typeof strOrBool === 'string') ? strOrBool : "string" : string
|
||||
>(typeof strOrBool === 'string') : boolean
|
||||
>typeof strOrBool === 'string' : boolean
|
||||
>typeof strOrBool : string
|
||||
>typeof strOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrBool : string | boolean
|
||||
>'string' : "string"
|
||||
>strOrBool : string
|
||||
@ -33,7 +33,7 @@ if ((typeof strOrBool === 'boolean' && !strOrBool) || typeof strOrBool === 'stri
|
||||
>(typeof strOrBool === 'boolean') ? strOrBool : false : boolean
|
||||
>(typeof strOrBool === 'boolean') : boolean
|
||||
>typeof strOrBool === 'boolean' : boolean
|
||||
>typeof strOrBool : string
|
||||
>typeof strOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrBool : string | boolean
|
||||
>'boolean' : "boolean"
|
||||
>strOrBool : boolean
|
||||
@ -44,7 +44,7 @@ if ((typeof strOrBool === 'boolean' && !strOrBool) || typeof strOrBool === 'stri
|
||||
>(typeof strOrBool !== 'boolean') ? strOrBool : "string" : string
|
||||
>(typeof strOrBool !== 'boolean') : boolean
|
||||
>typeof strOrBool !== 'boolean' : boolean
|
||||
>typeof strOrBool : string
|
||||
>typeof strOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrBool : string | boolean
|
||||
>'boolean' : "boolean"
|
||||
>strOrBool : string
|
||||
@ -55,7 +55,7 @@ if ((typeof strOrBool === 'boolean' && !strOrBool) || typeof strOrBool === 'stri
|
||||
>(typeof strOrBool !== 'string') ? strOrBool : false : boolean
|
||||
>(typeof strOrBool !== 'string') : boolean
|
||||
>typeof strOrBool !== 'string' : boolean
|
||||
>typeof strOrBool : string
|
||||
>typeof strOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrBool : string | boolean
|
||||
>'string' : "string"
|
||||
>strOrBool : boolean
|
||||
@ -67,13 +67,13 @@ if ((typeof strOrBool !== 'string' && !strOrBool) || typeof strOrBool !== 'boole
|
||||
>(typeof strOrBool !== 'string' && !strOrBool) : boolean
|
||||
>typeof strOrBool !== 'string' && !strOrBool : boolean
|
||||
>typeof strOrBool !== 'string' : boolean
|
||||
>typeof strOrBool : string
|
||||
>typeof strOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrBool : string | boolean
|
||||
>'string' : "string"
|
||||
>!strOrBool : boolean
|
||||
>strOrBool : boolean
|
||||
>typeof strOrBool !== 'boolean' : boolean
|
||||
>typeof strOrBool : string
|
||||
>typeof strOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrBool : string | true
|
||||
>'boolean' : "boolean"
|
||||
|
||||
@ -82,7 +82,7 @@ if ((typeof strOrBool !== 'string' && !strOrBool) || typeof strOrBool !== 'boole
|
||||
>(typeof strOrBool === 'string') ? strOrBool : "string" : string
|
||||
>(typeof strOrBool === 'string') : boolean
|
||||
>typeof strOrBool === 'string' : boolean
|
||||
>typeof strOrBool : string
|
||||
>typeof strOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrBool : string | boolean
|
||||
>'string' : "string"
|
||||
>strOrBool : string
|
||||
@ -93,7 +93,7 @@ if ((typeof strOrBool !== 'string' && !strOrBool) || typeof strOrBool !== 'boole
|
||||
>(typeof strOrBool === 'boolean') ? strOrBool : false : boolean
|
||||
>(typeof strOrBool === 'boolean') : boolean
|
||||
>typeof strOrBool === 'boolean' : boolean
|
||||
>typeof strOrBool : string
|
||||
>typeof strOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrBool : string | boolean
|
||||
>'boolean' : "boolean"
|
||||
>strOrBool : boolean
|
||||
@ -104,7 +104,7 @@ if ((typeof strOrBool !== 'string' && !strOrBool) || typeof strOrBool !== 'boole
|
||||
>(typeof strOrBool !== 'boolean') ? strOrBool : "string" : string
|
||||
>(typeof strOrBool !== 'boolean') : boolean
|
||||
>typeof strOrBool !== 'boolean' : boolean
|
||||
>typeof strOrBool : string
|
||||
>typeof strOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrBool : string | boolean
|
||||
>'boolean' : "boolean"
|
||||
>strOrBool : string
|
||||
@ -115,7 +115,7 @@ if ((typeof strOrBool !== 'string' && !strOrBool) || typeof strOrBool !== 'boole
|
||||
>(typeof strOrBool !== 'string') ? strOrBool : false : boolean
|
||||
>(typeof strOrBool !== 'string') : boolean
|
||||
>typeof strOrBool !== 'string' : boolean
|
||||
>typeof strOrBool : string
|
||||
>typeof strOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrBool : string | boolean
|
||||
>'string' : "string"
|
||||
>strOrBool : boolean
|
||||
|
||||
@ -42,11 +42,11 @@ var strOrNumOrBoolOrC: string | number | boolean | C;
|
||||
if (typeof strOrNumOrBool !== "string" && typeof strOrNumOrBool !== "number") {
|
||||
>typeof strOrNumOrBool !== "string" && typeof strOrNumOrBool !== "number" : boolean
|
||||
>typeof strOrNumOrBool !== "string" : boolean
|
||||
>typeof strOrNumOrBool : string
|
||||
>typeof strOrNumOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBool : string | number | boolean
|
||||
>"string" : "string"
|
||||
>typeof strOrNumOrBool !== "number" : boolean
|
||||
>typeof strOrNumOrBool : string
|
||||
>typeof strOrNumOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBool : number | boolean
|
||||
>"number" : "number"
|
||||
|
||||
@ -66,15 +66,15 @@ if (typeof strOrNumOrBoolOrC !== "string" && typeof strOrNumOrBoolOrC !== "numbe
|
||||
>typeof strOrNumOrBoolOrC !== "string" && typeof strOrNumOrBoolOrC !== "number" && typeof strOrNumOrBoolOrC !== "boolean" : boolean
|
||||
>typeof strOrNumOrBoolOrC !== "string" && typeof strOrNumOrBoolOrC !== "number" : boolean
|
||||
>typeof strOrNumOrBoolOrC !== "string" : boolean
|
||||
>typeof strOrNumOrBoolOrC : string
|
||||
>typeof strOrNumOrBoolOrC : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBoolOrC : string | number | boolean | C
|
||||
>"string" : "string"
|
||||
>typeof strOrNumOrBoolOrC !== "number" : boolean
|
||||
>typeof strOrNumOrBoolOrC : string
|
||||
>typeof strOrNumOrBoolOrC : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBoolOrC : number | boolean | C
|
||||
>"number" : "number"
|
||||
>typeof strOrNumOrBoolOrC !== "boolean" : boolean
|
||||
>typeof strOrNumOrBoolOrC : string
|
||||
>typeof strOrNumOrBoolOrC : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBoolOrC : boolean | C
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -94,15 +94,15 @@ if (typeof strOrNumOrBoolOrC !== "string" && typeof strOrNumOrBoolOrC !== "numbe
|
||||
>typeof strOrNumOrBoolOrC !== "string" && typeof strOrNumOrBoolOrC !== "number" && typeof strOrNumOrBool === "boolean" : boolean
|
||||
>typeof strOrNumOrBoolOrC !== "string" && typeof strOrNumOrBoolOrC !== "number" : boolean
|
||||
>typeof strOrNumOrBoolOrC !== "string" : boolean
|
||||
>typeof strOrNumOrBoolOrC : string
|
||||
>typeof strOrNumOrBoolOrC : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBoolOrC : string | number | boolean | C
|
||||
>"string" : "string"
|
||||
>typeof strOrNumOrBoolOrC !== "number" : boolean
|
||||
>typeof strOrNumOrBoolOrC : string
|
||||
>typeof strOrNumOrBoolOrC : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBoolOrC : number | boolean | C
|
||||
>"number" : "number"
|
||||
>typeof strOrNumOrBool === "boolean" : boolean
|
||||
>typeof strOrNumOrBool : string
|
||||
>typeof strOrNumOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBool : string | number | boolean
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -130,7 +130,7 @@ else {
|
||||
if (typeof strOrNumOrBool !== "string" && numOrBool !== strOrNumOrBool) {
|
||||
>typeof strOrNumOrBool !== "string" && numOrBool !== strOrNumOrBool : boolean
|
||||
>typeof strOrNumOrBool !== "string" : boolean
|
||||
>typeof strOrNumOrBool : string
|
||||
>typeof strOrNumOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBool : string | number | boolean
|
||||
>"string" : "string"
|
||||
>numOrBool !== strOrNumOrBool : boolean
|
||||
|
||||
@ -42,11 +42,11 @@ var strOrNumOrBoolOrC: string | number | boolean | C;
|
||||
if (typeof strOrNumOrBool === "string" || typeof strOrNumOrBool === "number") {
|
||||
>typeof strOrNumOrBool === "string" || typeof strOrNumOrBool === "number" : boolean
|
||||
>typeof strOrNumOrBool === "string" : boolean
|
||||
>typeof strOrNumOrBool : string
|
||||
>typeof strOrNumOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBool : string | number | boolean
|
||||
>"string" : "string"
|
||||
>typeof strOrNumOrBool === "number" : boolean
|
||||
>typeof strOrNumOrBool : string
|
||||
>typeof strOrNumOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBool : number | boolean
|
||||
>"number" : "number"
|
||||
|
||||
@ -66,15 +66,15 @@ if (typeof strOrNumOrBoolOrC === "string" || typeof strOrNumOrBoolOrC === "numbe
|
||||
>typeof strOrNumOrBoolOrC === "string" || typeof strOrNumOrBoolOrC === "number" || typeof strOrNumOrBoolOrC === "boolean" : boolean
|
||||
>typeof strOrNumOrBoolOrC === "string" || typeof strOrNumOrBoolOrC === "number" : boolean
|
||||
>typeof strOrNumOrBoolOrC === "string" : boolean
|
||||
>typeof strOrNumOrBoolOrC : string
|
||||
>typeof strOrNumOrBoolOrC : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBoolOrC : string | number | boolean | C
|
||||
>"string" : "string"
|
||||
>typeof strOrNumOrBoolOrC === "number" : boolean
|
||||
>typeof strOrNumOrBoolOrC : string
|
||||
>typeof strOrNumOrBoolOrC : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBoolOrC : number | boolean | C
|
||||
>"number" : "number"
|
||||
>typeof strOrNumOrBoolOrC === "boolean" : boolean
|
||||
>typeof strOrNumOrBoolOrC : string
|
||||
>typeof strOrNumOrBoolOrC : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBoolOrC : boolean | C
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -94,15 +94,15 @@ if (typeof strOrNumOrBoolOrC === "string" || typeof strOrNumOrBoolOrC === "numbe
|
||||
>typeof strOrNumOrBoolOrC === "string" || typeof strOrNumOrBoolOrC === "number" || typeof strOrNumOrBool !== "boolean" : boolean
|
||||
>typeof strOrNumOrBoolOrC === "string" || typeof strOrNumOrBoolOrC === "number" : boolean
|
||||
>typeof strOrNumOrBoolOrC === "string" : boolean
|
||||
>typeof strOrNumOrBoolOrC : string
|
||||
>typeof strOrNumOrBoolOrC : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBoolOrC : string | number | boolean | C
|
||||
>"string" : "string"
|
||||
>typeof strOrNumOrBoolOrC === "number" : boolean
|
||||
>typeof strOrNumOrBoolOrC : string
|
||||
>typeof strOrNumOrBoolOrC : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBoolOrC : number | boolean | C
|
||||
>"number" : "number"
|
||||
>typeof strOrNumOrBool !== "boolean" : boolean
|
||||
>typeof strOrNumOrBool : string
|
||||
>typeof strOrNumOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBool : string | number | boolean
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -130,7 +130,7 @@ else {
|
||||
if (typeof strOrNumOrBool === "string" || numOrBool !== strOrNumOrBool) {
|
||||
>typeof strOrNumOrBool === "string" || numOrBool !== strOrNumOrBool : boolean
|
||||
>typeof strOrNumOrBool === "string" : boolean
|
||||
>typeof strOrNumOrBool : string
|
||||
>typeof strOrNumOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBool : string | number | boolean
|
||||
>"string" : "string"
|
||||
>numOrBool !== strOrNumOrBool : boolean
|
||||
|
||||
@ -26,7 +26,7 @@ if (!(typeof strOrNum === "string")) {
|
||||
>!(typeof strOrNum === "string") : boolean
|
||||
>(typeof strOrNum === "string") : boolean
|
||||
>typeof strOrNum === "string" : boolean
|
||||
>typeof strOrNum : string
|
||||
>typeof strOrNum : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNum : string | number
|
||||
>"string" : "string"
|
||||
|
||||
@ -47,11 +47,11 @@ if (!(typeof strOrNumOrBool === "string" || typeof strOrNumOrBool === "number"))
|
||||
>(typeof strOrNumOrBool === "string" || typeof strOrNumOrBool === "number") : boolean
|
||||
>typeof strOrNumOrBool === "string" || typeof strOrNumOrBool === "number" : boolean
|
||||
>typeof strOrNumOrBool === "string" : boolean
|
||||
>typeof strOrNumOrBool : string
|
||||
>typeof strOrNumOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBool : string | number | boolean
|
||||
>"string" : "string"
|
||||
>typeof strOrNumOrBool === "number" : boolean
|
||||
>typeof strOrNumOrBool : string
|
||||
>typeof strOrNumOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBool : number | boolean
|
||||
>"number" : "number"
|
||||
|
||||
@ -72,13 +72,13 @@ if (!(typeof strOrNumOrBool !== "string") || !(typeof strOrNumOrBool !== "number
|
||||
>!(typeof strOrNumOrBool !== "string") : boolean
|
||||
>(typeof strOrNumOrBool !== "string") : boolean
|
||||
>typeof strOrNumOrBool !== "string" : boolean
|
||||
>typeof strOrNumOrBool : string
|
||||
>typeof strOrNumOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBool : string | number | boolean
|
||||
>"string" : "string"
|
||||
>!(typeof strOrNumOrBool !== "number") : boolean
|
||||
>(typeof strOrNumOrBool !== "number") : boolean
|
||||
>typeof strOrNumOrBool !== "number" : boolean
|
||||
>typeof strOrNumOrBool : string
|
||||
>typeof strOrNumOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBool : number | boolean
|
||||
>"number" : "number"
|
||||
|
||||
@ -99,11 +99,11 @@ if (!(typeof strOrNumOrBool !== "string" && typeof strOrNumOrBool !== "number"))
|
||||
>(typeof strOrNumOrBool !== "string" && typeof strOrNumOrBool !== "number") : boolean
|
||||
>typeof strOrNumOrBool !== "string" && typeof strOrNumOrBool !== "number" : boolean
|
||||
>typeof strOrNumOrBool !== "string" : boolean
|
||||
>typeof strOrNumOrBool : string
|
||||
>typeof strOrNumOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBool : string | number | boolean
|
||||
>"string" : "string"
|
||||
>typeof strOrNumOrBool !== "number" : boolean
|
||||
>typeof strOrNumOrBool : string
|
||||
>typeof strOrNumOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBool : number | boolean
|
||||
>"number" : "number"
|
||||
|
||||
@ -124,13 +124,13 @@ if (!(typeof strOrNumOrBool === "string") && !(typeof strOrNumOrBool === "number
|
||||
>!(typeof strOrNumOrBool === "string") : boolean
|
||||
>(typeof strOrNumOrBool === "string") : boolean
|
||||
>typeof strOrNumOrBool === "string" : boolean
|
||||
>typeof strOrNumOrBool : string
|
||||
>typeof strOrNumOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBool : string | number | boolean
|
||||
>"string" : "string"
|
||||
>!(typeof strOrNumOrBool === "number") : boolean
|
||||
>(typeof strOrNumOrBool === "number") : boolean
|
||||
>typeof strOrNumOrBool === "number" : boolean
|
||||
>typeof strOrNumOrBool : string
|
||||
>typeof strOrNumOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBool : number | boolean
|
||||
>"number" : "number"
|
||||
|
||||
@ -151,7 +151,7 @@ if (!(typeof strOrNumOrBool === "string") && numOrBool !== strOrNumOrBool) {
|
||||
>!(typeof strOrNumOrBool === "string") : boolean
|
||||
>(typeof strOrNumOrBool === "string") : boolean
|
||||
>typeof strOrNumOrBool === "string" : boolean
|
||||
>typeof strOrNumOrBool : string
|
||||
>typeof strOrNumOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBool : string | number | boolean
|
||||
>"string" : "string"
|
||||
>numOrBool !== strOrNumOrBool : boolean
|
||||
|
||||
@ -46,7 +46,7 @@ var c: C;
|
||||
// - when false, removes the primitive type from the type of x.
|
||||
if (typeof strOrBool === "boolean") {
|
||||
>typeof strOrBool === "boolean" : boolean
|
||||
>typeof strOrBool : string
|
||||
>typeof strOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrBool : string | boolean
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -63,7 +63,7 @@ else {
|
||||
}
|
||||
if (typeof numOrBool === "boolean") {
|
||||
>typeof numOrBool === "boolean" : boolean
|
||||
>typeof numOrBool : string
|
||||
>typeof numOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>numOrBool : number | boolean
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -80,7 +80,7 @@ else {
|
||||
}
|
||||
if (typeof strOrNumOrBool === "boolean") {
|
||||
>typeof strOrNumOrBool === "boolean" : boolean
|
||||
>typeof strOrNumOrBool : string
|
||||
>typeof strOrNumOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBool : string | number | boolean
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -97,7 +97,7 @@ else {
|
||||
}
|
||||
if (typeof boolOrC === "boolean") {
|
||||
>typeof boolOrC === "boolean" : boolean
|
||||
>typeof boolOrC : string
|
||||
>typeof boolOrC : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>boolOrC : boolean | C
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -115,7 +115,7 @@ else {
|
||||
|
||||
if (typeof strOrNum === "boolean") {
|
||||
>typeof strOrNum === "boolean" : boolean
|
||||
>typeof strOrNum : string
|
||||
>typeof strOrNum : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNum : string | number
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -135,7 +135,7 @@ else {
|
||||
// - when false, narrows the type of x by typeof x === s when true.
|
||||
if (typeof strOrBool !== "boolean") {
|
||||
>typeof strOrBool !== "boolean" : boolean
|
||||
>typeof strOrBool : string
|
||||
>typeof strOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrBool : string | boolean
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -152,7 +152,7 @@ else {
|
||||
}
|
||||
if (typeof numOrBool !== "boolean") {
|
||||
>typeof numOrBool !== "boolean" : boolean
|
||||
>typeof numOrBool : string
|
||||
>typeof numOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>numOrBool : number | boolean
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -169,7 +169,7 @@ else {
|
||||
}
|
||||
if (typeof strOrNumOrBool !== "boolean") {
|
||||
>typeof strOrNumOrBool !== "boolean" : boolean
|
||||
>typeof strOrNumOrBool : string
|
||||
>typeof strOrNumOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBool : string | number | boolean
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -186,7 +186,7 @@ else {
|
||||
}
|
||||
if (typeof boolOrC !== "boolean") {
|
||||
>typeof boolOrC !== "boolean" : boolean
|
||||
>typeof boolOrC : string
|
||||
>typeof boolOrC : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>boolOrC : boolean | C
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -204,7 +204,7 @@ else {
|
||||
|
||||
if (typeof strOrNum !== "boolean") {
|
||||
>typeof strOrNum !== "boolean" : boolean
|
||||
>typeof strOrNum : string
|
||||
>typeof strOrNum : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNum : string | number
|
||||
>"boolean" : "boolean"
|
||||
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts(13,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r1' must be of type 'string', but here has type 'number'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts(20,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r2' must be of type 'boolean', but here has type 'string'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts(27,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r3' must be of type 'number', but here has type 'boolean'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts(30,5): error TS2365: Operator '==' cannot be applied to types '"string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"' and '"Object"'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts(34,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'C', but here has type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts (4 errors) ====
|
||||
==== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts (5 errors) ====
|
||||
class C { private p: string };
|
||||
|
||||
var strOrNum: string | number;
|
||||
@ -41,6 +42,8 @@ tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHa
|
||||
}
|
||||
|
||||
if (typeof strOrC == "Object") {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '==' cannot be applied to types '"string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"' and '"Object"'.
|
||||
var r4 = strOrC; // string | C
|
||||
}
|
||||
else {
|
||||
|
||||
@ -26,7 +26,7 @@ var func: () => void;
|
||||
if ("string" === typeof strOrNum) {
|
||||
>"string" === typeof strOrNum : boolean
|
||||
>"string" : "string"
|
||||
>typeof strOrNum : string
|
||||
>typeof strOrNum : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNum : string | number
|
||||
|
||||
str = strOrNum;
|
||||
@ -43,7 +43,7 @@ else {
|
||||
if ("function" === typeof strOrFunc) {
|
||||
>"function" === typeof strOrFunc : boolean
|
||||
>"function" : "function"
|
||||
>typeof strOrFunc : string
|
||||
>typeof strOrFunc : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrFunc : string | (() => void)
|
||||
|
||||
func = strOrFunc;
|
||||
@ -60,7 +60,7 @@ else {
|
||||
if ("number" === typeof numOrBool) {
|
||||
>"number" === typeof numOrBool : boolean
|
||||
>"number" : "number"
|
||||
>typeof numOrBool : string
|
||||
>typeof numOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>numOrBool : number | boolean
|
||||
|
||||
num = numOrBool;
|
||||
@ -77,7 +77,7 @@ else {
|
||||
if ("boolean" === typeof strOrBool) {
|
||||
>"boolean" === typeof strOrBool : boolean
|
||||
>"boolean" : "boolean"
|
||||
>typeof strOrBool : string
|
||||
>typeof strOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrBool : string | boolean
|
||||
|
||||
bool = strOrBool;
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts(13,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r1' must be of type 'number', but here has type 'string'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts(20,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r2' must be of type 'string', but here has type 'boolean'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts(27,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r3' must be of type 'boolean', but here has type 'number'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts(30,5): error TS2365: Operator '!=' cannot be applied to types '"string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"' and '"Object"'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts(34,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'string', but here has type 'C'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts (4 errors) ====
|
||||
==== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts (5 errors) ====
|
||||
class C { private p: string };
|
||||
|
||||
var strOrNum: string | number;
|
||||
@ -41,6 +42,8 @@ tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasN
|
||||
}
|
||||
|
||||
if (typeof strOrC != "Object") {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '!=' cannot be applied to types '"string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"' and '"Object"'.
|
||||
var r4 = strOrC; // string | C
|
||||
}
|
||||
else {
|
||||
|
||||
@ -46,7 +46,7 @@ var c: C;
|
||||
// - when false, removes the primitive type from the type of x.
|
||||
if (typeof strOrNum === "number") {
|
||||
>typeof strOrNum === "number" : boolean
|
||||
>typeof strOrNum : string
|
||||
>typeof strOrNum : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNum : string | number
|
||||
>"number" : "number"
|
||||
|
||||
@ -63,7 +63,7 @@ else {
|
||||
}
|
||||
if (typeof numOrBool === "number") {
|
||||
>typeof numOrBool === "number" : boolean
|
||||
>typeof numOrBool : string
|
||||
>typeof numOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>numOrBool : number | boolean
|
||||
>"number" : "number"
|
||||
|
||||
@ -79,7 +79,7 @@ else {
|
||||
}
|
||||
if (typeof strOrNumOrBool === "number") {
|
||||
>typeof strOrNumOrBool === "number" : boolean
|
||||
>typeof strOrNumOrBool : string
|
||||
>typeof strOrNumOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBool : string | number | boolean
|
||||
>"number" : "number"
|
||||
|
||||
@ -96,7 +96,7 @@ else {
|
||||
}
|
||||
if (typeof numOrC === "number") {
|
||||
>typeof numOrC === "number" : boolean
|
||||
>typeof numOrC : string
|
||||
>typeof numOrC : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>numOrC : number | C
|
||||
>"number" : "number"
|
||||
|
||||
@ -114,7 +114,7 @@ else {
|
||||
|
||||
if (typeof strOrBool === "number") {
|
||||
>typeof strOrBool === "number" : boolean
|
||||
>typeof strOrBool : string
|
||||
>typeof strOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrBool : string | boolean
|
||||
>"number" : "number"
|
||||
|
||||
@ -133,7 +133,7 @@ else {
|
||||
// - when false, narrows the type of x by typeof x === s when true.
|
||||
if (typeof strOrNum !== "number") {
|
||||
>typeof strOrNum !== "number" : boolean
|
||||
>typeof strOrNum : string
|
||||
>typeof strOrNum : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNum : string | number
|
||||
>"number" : "number"
|
||||
|
||||
@ -150,7 +150,7 @@ else {
|
||||
}
|
||||
if (typeof numOrBool !== "number") {
|
||||
>typeof numOrBool !== "number" : boolean
|
||||
>typeof numOrBool : string
|
||||
>typeof numOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>numOrBool : number | boolean
|
||||
>"number" : "number"
|
||||
|
||||
@ -166,7 +166,7 @@ else {
|
||||
}
|
||||
if (typeof strOrNumOrBool !== "number") {
|
||||
>typeof strOrNumOrBool !== "number" : boolean
|
||||
>typeof strOrNumOrBool : string
|
||||
>typeof strOrNumOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBool : string | number | boolean
|
||||
>"number" : "number"
|
||||
|
||||
@ -183,7 +183,7 @@ else {
|
||||
}
|
||||
if (typeof numOrC !== "number") {
|
||||
>typeof numOrC !== "number" : boolean
|
||||
>typeof numOrC : string
|
||||
>typeof numOrC : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>numOrC : number | C
|
||||
>"number" : "number"
|
||||
|
||||
@ -201,7 +201,7 @@ else {
|
||||
|
||||
if (typeof strOrBool !== "number") {
|
||||
>typeof strOrBool !== "number" : boolean
|
||||
>typeof strOrBool : string
|
||||
>typeof strOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrBool : string | boolean
|
||||
>"number" : "number"
|
||||
|
||||
|
||||
118
tests/baselines/reference/typeGuardOfFormTypeOfOther.errors.txt
Normal file
118
tests/baselines/reference/typeGuardOfFormTypeOfOther.errors.txt
Normal file
@ -0,0 +1,118 @@
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfOther.ts(21,5): error TS2365: Operator '===' cannot be applied to types '"string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"' and '"Object"'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfOther.ts(27,5): error TS2365: Operator '===' cannot be applied to types '"string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"' and '"Object"'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfOther.ts(33,5): error TS2365: Operator '===' cannot be applied to types '"string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"' and '"Object"'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfOther.ts(40,5): error TS2322: Type 'string | C' is not assignable to type 'C'.
|
||||
Type 'string' is not assignable to type 'C'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfOther.ts(43,9): error TS2322: Type 'string | C' is not assignable to type 'string'.
|
||||
Type 'C' is not assignable to type 'string'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfOther.ts(46,5): error TS2365: Operator '===' cannot be applied to types '"string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"' and '"Object"'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfOther.ts(56,5): error TS2365: Operator '!==' cannot be applied to types '"string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"' and '"Object"'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfOther.ts(62,5): error TS2365: Operator '!==' cannot be applied to types '"string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"' and '"Object"'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfOther.ts(68,5): error TS2365: Operator '!==' cannot be applied to types '"string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"' and '"Object"'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfOther.ts(75,5): error TS2365: Operator '!==' cannot be applied to types '"string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"' and '"Object"'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfOther.ts (10 errors) ====
|
||||
class C { private p: string };
|
||||
|
||||
var str: string;
|
||||
var bool: boolean;
|
||||
var num: number;
|
||||
var strOrNum: string | number;
|
||||
var strOrBool: string | boolean;
|
||||
var numOrBool: number | boolean
|
||||
var strOrNumOrBool: string | number | boolean;
|
||||
var strOrC: string | C;
|
||||
var numOrC: number | C;
|
||||
var boolOrC: boolean | C;
|
||||
var emptyObj: {};
|
||||
var c: C;
|
||||
|
||||
// A type guard of the form typeof x === s,
|
||||
// where s is a string literal with any value but 'string', 'number' or 'boolean',
|
||||
// - when true, removes the primitive types string, number, and boolean from the type of x, or
|
||||
// - when false, has no effect on the type of x.
|
||||
|
||||
if (typeof strOrC === "Object") {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '===' cannot be applied to types '"string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"' and '"Object"'.
|
||||
c = strOrC; // C
|
||||
}
|
||||
else {
|
||||
var r2: string = strOrC; // string
|
||||
}
|
||||
if (typeof numOrC === "Object") {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '===' cannot be applied to types '"string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"' and '"Object"'.
|
||||
c = numOrC; // C
|
||||
}
|
||||
else {
|
||||
var r3: number = numOrC; // number
|
||||
}
|
||||
if (typeof boolOrC === "Object") {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '===' cannot be applied to types '"string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"' and '"Object"'.
|
||||
c = boolOrC; // C
|
||||
}
|
||||
else {
|
||||
var r4: boolean = boolOrC; // boolean
|
||||
}
|
||||
if (typeof strOrC === "Object" as string) { // comparison is OK with cast
|
||||
c = strOrC; // error: but no narrowing to C
|
||||
~
|
||||
!!! error TS2322: Type 'string | C' is not assignable to type 'C'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'C'.
|
||||
}
|
||||
else {
|
||||
var r5: string = strOrC; // error: no narrowing to string
|
||||
~~
|
||||
!!! error TS2322: Type 'string | C' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'C' is not assignable to type 'string'.
|
||||
}
|
||||
|
||||
if (typeof strOrNumOrBool === "Object") {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '===' cannot be applied to types '"string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"' and '"Object"'.
|
||||
let q1: {} = strOrNumOrBool; // {}
|
||||
}
|
||||
else {
|
||||
let q2: string | number | boolean = strOrNumOrBool; // string | number | boolean
|
||||
}
|
||||
|
||||
// A type guard of the form typeof x !== s, where s is a string literal,
|
||||
// - when true, narrows the type of x by typeof x === s when false, or
|
||||
// - when false, narrows the type of x by typeof x === s when true.
|
||||
if (typeof strOrC !== "Object") {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '!==' cannot be applied to types '"string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"' and '"Object"'.
|
||||
var r2: string = strOrC; // string
|
||||
}
|
||||
else {
|
||||
c = strOrC; // C
|
||||
}
|
||||
if (typeof numOrC !== "Object") {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '!==' cannot be applied to types '"string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"' and '"Object"'.
|
||||
var r3: number = numOrC; // number
|
||||
}
|
||||
else {
|
||||
c = numOrC; // C
|
||||
}
|
||||
if (typeof boolOrC !== "Object") {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '!==' cannot be applied to types '"string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"' and '"Object"'.
|
||||
var r4: boolean = boolOrC; // boolean
|
||||
}
|
||||
else {
|
||||
c = boolOrC; // C
|
||||
}
|
||||
|
||||
if (typeof strOrNumOrBool !== "Object") {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '!==' cannot be applied to types '"string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"' and '"Object"'.
|
||||
let q1: string | number | boolean = strOrNumOrBool; // string | number | boolean
|
||||
}
|
||||
else {
|
||||
let q2: {} = strOrNumOrBool; // {}
|
||||
}
|
||||
|
||||
@ -37,6 +37,12 @@ if (typeof boolOrC === "Object") {
|
||||
else {
|
||||
var r4: boolean = boolOrC; // boolean
|
||||
}
|
||||
if (typeof strOrC === "Object" as string) { // comparison is OK with cast
|
||||
c = strOrC; // error: but no narrowing to C
|
||||
}
|
||||
else {
|
||||
var r5: string = strOrC; // error: no narrowing to string
|
||||
}
|
||||
|
||||
if (typeof strOrNumOrBool === "Object") {
|
||||
let q1: {} = strOrNumOrBool; // {}
|
||||
@ -116,6 +122,12 @@ if (typeof boolOrC === "Object") {
|
||||
else {
|
||||
var r4 = boolOrC; // boolean
|
||||
}
|
||||
if (typeof strOrC === "Object") {
|
||||
c = strOrC; // error: but no narrowing to C
|
||||
}
|
||||
else {
|
||||
var r5 = strOrC; // error: no narrowing to string
|
||||
}
|
||||
if (typeof strOrNumOrBool === "Object") {
|
||||
var q1 = strOrNumOrBool; // {}
|
||||
}
|
||||
|
||||
@ -1,153 +0,0 @@
|
||||
=== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfOther.ts ===
|
||||
class C { private p: string };
|
||||
>C : Symbol(C, Decl(typeGuardOfFormTypeOfOther.ts, 0, 0))
|
||||
>p : Symbol(C.p, Decl(typeGuardOfFormTypeOfOther.ts, 0, 9))
|
||||
|
||||
var str: string;
|
||||
>str : Symbol(str, Decl(typeGuardOfFormTypeOfOther.ts, 2, 3))
|
||||
|
||||
var bool: boolean;
|
||||
>bool : Symbol(bool, Decl(typeGuardOfFormTypeOfOther.ts, 3, 3))
|
||||
|
||||
var num: number;
|
||||
>num : Symbol(num, Decl(typeGuardOfFormTypeOfOther.ts, 4, 3))
|
||||
|
||||
var strOrNum: string | number;
|
||||
>strOrNum : Symbol(strOrNum, Decl(typeGuardOfFormTypeOfOther.ts, 5, 3))
|
||||
|
||||
var strOrBool: string | boolean;
|
||||
>strOrBool : Symbol(strOrBool, Decl(typeGuardOfFormTypeOfOther.ts, 6, 3))
|
||||
|
||||
var numOrBool: number | boolean
|
||||
>numOrBool : Symbol(numOrBool, Decl(typeGuardOfFormTypeOfOther.ts, 7, 3))
|
||||
|
||||
var strOrNumOrBool: string | number | boolean;
|
||||
>strOrNumOrBool : Symbol(strOrNumOrBool, Decl(typeGuardOfFormTypeOfOther.ts, 8, 3))
|
||||
|
||||
var strOrC: string | C;
|
||||
>strOrC : Symbol(strOrC, Decl(typeGuardOfFormTypeOfOther.ts, 9, 3))
|
||||
>C : Symbol(C, Decl(typeGuardOfFormTypeOfOther.ts, 0, 0))
|
||||
|
||||
var numOrC: number | C;
|
||||
>numOrC : Symbol(numOrC, Decl(typeGuardOfFormTypeOfOther.ts, 10, 3))
|
||||
>C : Symbol(C, Decl(typeGuardOfFormTypeOfOther.ts, 0, 0))
|
||||
|
||||
var boolOrC: boolean | C;
|
||||
>boolOrC : Symbol(boolOrC, Decl(typeGuardOfFormTypeOfOther.ts, 11, 3))
|
||||
>C : Symbol(C, Decl(typeGuardOfFormTypeOfOther.ts, 0, 0))
|
||||
|
||||
var emptyObj: {};
|
||||
>emptyObj : Symbol(emptyObj, Decl(typeGuardOfFormTypeOfOther.ts, 12, 3))
|
||||
|
||||
var c: C;
|
||||
>c : Symbol(c, Decl(typeGuardOfFormTypeOfOther.ts, 13, 3))
|
||||
>C : Symbol(C, Decl(typeGuardOfFormTypeOfOther.ts, 0, 0))
|
||||
|
||||
// A type guard of the form typeof x === s,
|
||||
// where s is a string literal with any value but 'string', 'number' or 'boolean',
|
||||
// - when true, removes the primitive types string, number, and boolean from the type of x, or
|
||||
// - when false, has no effect on the type of x.
|
||||
|
||||
if (typeof strOrC === "Object") {
|
||||
>strOrC : Symbol(strOrC, Decl(typeGuardOfFormTypeOfOther.ts, 9, 3))
|
||||
|
||||
c = strOrC; // C
|
||||
>c : Symbol(c, Decl(typeGuardOfFormTypeOfOther.ts, 13, 3))
|
||||
>strOrC : Symbol(strOrC, Decl(typeGuardOfFormTypeOfOther.ts, 9, 3))
|
||||
}
|
||||
else {
|
||||
var r2: string = strOrC; // string
|
||||
>r2 : Symbol(r2, Decl(typeGuardOfFormTypeOfOther.ts, 24, 7), Decl(typeGuardOfFormTypeOfOther.ts, 50, 7))
|
||||
>strOrC : Symbol(strOrC, Decl(typeGuardOfFormTypeOfOther.ts, 9, 3))
|
||||
}
|
||||
if (typeof numOrC === "Object") {
|
||||
>numOrC : Symbol(numOrC, Decl(typeGuardOfFormTypeOfOther.ts, 10, 3))
|
||||
|
||||
c = numOrC; // C
|
||||
>c : Symbol(c, Decl(typeGuardOfFormTypeOfOther.ts, 13, 3))
|
||||
>numOrC : Symbol(numOrC, Decl(typeGuardOfFormTypeOfOther.ts, 10, 3))
|
||||
}
|
||||
else {
|
||||
var r3: number = numOrC; // number
|
||||
>r3 : Symbol(r3, Decl(typeGuardOfFormTypeOfOther.ts, 30, 7), Decl(typeGuardOfFormTypeOfOther.ts, 56, 7))
|
||||
>numOrC : Symbol(numOrC, Decl(typeGuardOfFormTypeOfOther.ts, 10, 3))
|
||||
}
|
||||
if (typeof boolOrC === "Object") {
|
||||
>boolOrC : Symbol(boolOrC, Decl(typeGuardOfFormTypeOfOther.ts, 11, 3))
|
||||
|
||||
c = boolOrC; // C
|
||||
>c : Symbol(c, Decl(typeGuardOfFormTypeOfOther.ts, 13, 3))
|
||||
>boolOrC : Symbol(boolOrC, Decl(typeGuardOfFormTypeOfOther.ts, 11, 3))
|
||||
}
|
||||
else {
|
||||
var r4: boolean = boolOrC; // boolean
|
||||
>r4 : Symbol(r4, Decl(typeGuardOfFormTypeOfOther.ts, 36, 7), Decl(typeGuardOfFormTypeOfOther.ts, 62, 7))
|
||||
>boolOrC : Symbol(boolOrC, Decl(typeGuardOfFormTypeOfOther.ts, 11, 3))
|
||||
}
|
||||
|
||||
if (typeof strOrNumOrBool === "Object") {
|
||||
>strOrNumOrBool : Symbol(strOrNumOrBool, Decl(typeGuardOfFormTypeOfOther.ts, 8, 3))
|
||||
|
||||
let q1: {} = strOrNumOrBool; // {}
|
||||
>q1 : Symbol(q1, Decl(typeGuardOfFormTypeOfOther.ts, 40, 7))
|
||||
>strOrNumOrBool : Symbol(strOrNumOrBool, Decl(typeGuardOfFormTypeOfOther.ts, 8, 3))
|
||||
}
|
||||
else {
|
||||
let q2: string | number | boolean = strOrNumOrBool; // string | number | boolean
|
||||
>q2 : Symbol(q2, Decl(typeGuardOfFormTypeOfOther.ts, 43, 7))
|
||||
>strOrNumOrBool : Symbol(strOrNumOrBool, Decl(typeGuardOfFormTypeOfOther.ts, 8, 3))
|
||||
}
|
||||
|
||||
// A type guard of the form typeof x !== s, where s is a string literal,
|
||||
// - when true, narrows the type of x by typeof x === s when false, or
|
||||
// - when false, narrows the type of x by typeof x === s when true.
|
||||
if (typeof strOrC !== "Object") {
|
||||
>strOrC : Symbol(strOrC, Decl(typeGuardOfFormTypeOfOther.ts, 9, 3))
|
||||
|
||||
var r2: string = strOrC; // string
|
||||
>r2 : Symbol(r2, Decl(typeGuardOfFormTypeOfOther.ts, 24, 7), Decl(typeGuardOfFormTypeOfOther.ts, 50, 7))
|
||||
>strOrC : Symbol(strOrC, Decl(typeGuardOfFormTypeOfOther.ts, 9, 3))
|
||||
}
|
||||
else {
|
||||
c = strOrC; // C
|
||||
>c : Symbol(c, Decl(typeGuardOfFormTypeOfOther.ts, 13, 3))
|
||||
>strOrC : Symbol(strOrC, Decl(typeGuardOfFormTypeOfOther.ts, 9, 3))
|
||||
}
|
||||
if (typeof numOrC !== "Object") {
|
||||
>numOrC : Symbol(numOrC, Decl(typeGuardOfFormTypeOfOther.ts, 10, 3))
|
||||
|
||||
var r3: number = numOrC; // number
|
||||
>r3 : Symbol(r3, Decl(typeGuardOfFormTypeOfOther.ts, 30, 7), Decl(typeGuardOfFormTypeOfOther.ts, 56, 7))
|
||||
>numOrC : Symbol(numOrC, Decl(typeGuardOfFormTypeOfOther.ts, 10, 3))
|
||||
}
|
||||
else {
|
||||
c = numOrC; // C
|
||||
>c : Symbol(c, Decl(typeGuardOfFormTypeOfOther.ts, 13, 3))
|
||||
>numOrC : Symbol(numOrC, Decl(typeGuardOfFormTypeOfOther.ts, 10, 3))
|
||||
}
|
||||
if (typeof boolOrC !== "Object") {
|
||||
>boolOrC : Symbol(boolOrC, Decl(typeGuardOfFormTypeOfOther.ts, 11, 3))
|
||||
|
||||
var r4: boolean = boolOrC; // boolean
|
||||
>r4 : Symbol(r4, Decl(typeGuardOfFormTypeOfOther.ts, 36, 7), Decl(typeGuardOfFormTypeOfOther.ts, 62, 7))
|
||||
>boolOrC : Symbol(boolOrC, Decl(typeGuardOfFormTypeOfOther.ts, 11, 3))
|
||||
}
|
||||
else {
|
||||
c = boolOrC; // C
|
||||
>c : Symbol(c, Decl(typeGuardOfFormTypeOfOther.ts, 13, 3))
|
||||
>boolOrC : Symbol(boolOrC, Decl(typeGuardOfFormTypeOfOther.ts, 11, 3))
|
||||
}
|
||||
|
||||
if (typeof strOrNumOrBool !== "Object") {
|
||||
>strOrNumOrBool : Symbol(strOrNumOrBool, Decl(typeGuardOfFormTypeOfOther.ts, 8, 3))
|
||||
|
||||
let q1: string | number | boolean = strOrNumOrBool; // string | number | boolean
|
||||
>q1 : Symbol(q1, Decl(typeGuardOfFormTypeOfOther.ts, 69, 7))
|
||||
>strOrNumOrBool : Symbol(strOrNumOrBool, Decl(typeGuardOfFormTypeOfOther.ts, 8, 3))
|
||||
}
|
||||
else {
|
||||
let q2: {} = strOrNumOrBool; // {}
|
||||
>q2 : Symbol(q2, Decl(typeGuardOfFormTypeOfOther.ts, 72, 7))
|
||||
>strOrNumOrBool : Symbol(strOrNumOrBool, Decl(typeGuardOfFormTypeOfOther.ts, 8, 3))
|
||||
}
|
||||
|
||||
@ -1,183 +0,0 @@
|
||||
=== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfOther.ts ===
|
||||
class C { private p: string };
|
||||
>C : C
|
||||
>p : string
|
||||
|
||||
var str: string;
|
||||
>str : string
|
||||
|
||||
var bool: boolean;
|
||||
>bool : boolean
|
||||
|
||||
var num: number;
|
||||
>num : number
|
||||
|
||||
var strOrNum: string | number;
|
||||
>strOrNum : string | number
|
||||
|
||||
var strOrBool: string | boolean;
|
||||
>strOrBool : string | boolean
|
||||
|
||||
var numOrBool: number | boolean
|
||||
>numOrBool : number | boolean
|
||||
|
||||
var strOrNumOrBool: string | number | boolean;
|
||||
>strOrNumOrBool : string | number | boolean
|
||||
|
||||
var strOrC: string | C;
|
||||
>strOrC : string | C
|
||||
>C : C
|
||||
|
||||
var numOrC: number | C;
|
||||
>numOrC : number | C
|
||||
>C : C
|
||||
|
||||
var boolOrC: boolean | C;
|
||||
>boolOrC : boolean | C
|
||||
>C : C
|
||||
|
||||
var emptyObj: {};
|
||||
>emptyObj : {}
|
||||
|
||||
var c: C;
|
||||
>c : C
|
||||
>C : C
|
||||
|
||||
// A type guard of the form typeof x === s,
|
||||
// where s is a string literal with any value but 'string', 'number' or 'boolean',
|
||||
// - when true, removes the primitive types string, number, and boolean from the type of x, or
|
||||
// - when false, has no effect on the type of x.
|
||||
|
||||
if (typeof strOrC === "Object") {
|
||||
>typeof strOrC === "Object" : boolean
|
||||
>typeof strOrC : string
|
||||
>strOrC : string | C
|
||||
>"Object" : "Object"
|
||||
|
||||
c = strOrC; // C
|
||||
>c = strOrC : C
|
||||
>c : C
|
||||
>strOrC : C
|
||||
}
|
||||
else {
|
||||
var r2: string = strOrC; // string
|
||||
>r2 : string
|
||||
>strOrC : string
|
||||
}
|
||||
if (typeof numOrC === "Object") {
|
||||
>typeof numOrC === "Object" : boolean
|
||||
>typeof numOrC : string
|
||||
>numOrC : number | C
|
||||
>"Object" : "Object"
|
||||
|
||||
c = numOrC; // C
|
||||
>c = numOrC : C
|
||||
>c : C
|
||||
>numOrC : C
|
||||
}
|
||||
else {
|
||||
var r3: number = numOrC; // number
|
||||
>r3 : number
|
||||
>numOrC : number
|
||||
}
|
||||
if (typeof boolOrC === "Object") {
|
||||
>typeof boolOrC === "Object" : boolean
|
||||
>typeof boolOrC : string
|
||||
>boolOrC : boolean | C
|
||||
>"Object" : "Object"
|
||||
|
||||
c = boolOrC; // C
|
||||
>c = boolOrC : C
|
||||
>c : C
|
||||
>boolOrC : C
|
||||
}
|
||||
else {
|
||||
var r4: boolean = boolOrC; // boolean
|
||||
>r4 : boolean
|
||||
>boolOrC : boolean
|
||||
}
|
||||
|
||||
if (typeof strOrNumOrBool === "Object") {
|
||||
>typeof strOrNumOrBool === "Object" : boolean
|
||||
>typeof strOrNumOrBool : string
|
||||
>strOrNumOrBool : string | number | boolean
|
||||
>"Object" : "Object"
|
||||
|
||||
let q1: {} = strOrNumOrBool; // {}
|
||||
>q1 : {}
|
||||
>strOrNumOrBool : never
|
||||
}
|
||||
else {
|
||||
let q2: string | number | boolean = strOrNumOrBool; // string | number | boolean
|
||||
>q2 : string | number | boolean
|
||||
>strOrNumOrBool : string | number | boolean
|
||||
}
|
||||
|
||||
// A type guard of the form typeof x !== s, where s is a string literal,
|
||||
// - when true, narrows the type of x by typeof x === s when false, or
|
||||
// - when false, narrows the type of x by typeof x === s when true.
|
||||
if (typeof strOrC !== "Object") {
|
||||
>typeof strOrC !== "Object" : boolean
|
||||
>typeof strOrC : string
|
||||
>strOrC : string | C
|
||||
>"Object" : "Object"
|
||||
|
||||
var r2: string = strOrC; // string
|
||||
>r2 : string
|
||||
>strOrC : string
|
||||
}
|
||||
else {
|
||||
c = strOrC; // C
|
||||
>c = strOrC : C
|
||||
>c : C
|
||||
>strOrC : C
|
||||
}
|
||||
if (typeof numOrC !== "Object") {
|
||||
>typeof numOrC !== "Object" : boolean
|
||||
>typeof numOrC : string
|
||||
>numOrC : number | C
|
||||
>"Object" : "Object"
|
||||
|
||||
var r3: number = numOrC; // number
|
||||
>r3 : number
|
||||
>numOrC : number
|
||||
}
|
||||
else {
|
||||
c = numOrC; // C
|
||||
>c = numOrC : C
|
||||
>c : C
|
||||
>numOrC : C
|
||||
}
|
||||
if (typeof boolOrC !== "Object") {
|
||||
>typeof boolOrC !== "Object" : boolean
|
||||
>typeof boolOrC : string
|
||||
>boolOrC : boolean | C
|
||||
>"Object" : "Object"
|
||||
|
||||
var r4: boolean = boolOrC; // boolean
|
||||
>r4 : boolean
|
||||
>boolOrC : boolean
|
||||
}
|
||||
else {
|
||||
c = boolOrC; // C
|
||||
>c = boolOrC : C
|
||||
>c : C
|
||||
>boolOrC : C
|
||||
}
|
||||
|
||||
if (typeof strOrNumOrBool !== "Object") {
|
||||
>typeof strOrNumOrBool !== "Object" : boolean
|
||||
>typeof strOrNumOrBool : string
|
||||
>strOrNumOrBool : string | number | boolean
|
||||
>"Object" : "Object"
|
||||
|
||||
let q1: string | number | boolean = strOrNumOrBool; // string | number | boolean
|
||||
>q1 : string | number | boolean
|
||||
>strOrNumOrBool : string | number | boolean
|
||||
}
|
||||
else {
|
||||
let q2: {} = strOrNumOrBool; // {}
|
||||
>q2 : {}
|
||||
>strOrNumOrBool : never
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ let b: {toString(): string};
|
||||
|
||||
if (typeof a === "number") {
|
||||
>typeof a === "number" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : {}
|
||||
>"number" : "number"
|
||||
|
||||
@ -18,7 +18,7 @@ if (typeof a === "number") {
|
||||
}
|
||||
if (typeof a === "string") {
|
||||
>typeof a === "string" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : {}
|
||||
>"string" : "string"
|
||||
|
||||
@ -28,7 +28,7 @@ if (typeof a === "string") {
|
||||
}
|
||||
if (typeof a === "boolean") {
|
||||
>typeof a === "boolean" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : {}
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -39,7 +39,7 @@ if (typeof a === "boolean") {
|
||||
|
||||
if (typeof b === "number") {
|
||||
>typeof b === "number" : boolean
|
||||
>typeof b : string
|
||||
>typeof b : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>b : { toString(): string; }
|
||||
>"number" : "number"
|
||||
|
||||
@ -49,7 +49,7 @@ if (typeof b === "number") {
|
||||
}
|
||||
if (typeof b === "string") {
|
||||
>typeof b === "string" : boolean
|
||||
>typeof b : string
|
||||
>typeof b : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>b : { toString(): string; }
|
||||
>"string" : "string"
|
||||
|
||||
@ -59,7 +59,7 @@ if (typeof b === "string") {
|
||||
}
|
||||
if (typeof b === "boolean") {
|
||||
>typeof b === "boolean" : boolean
|
||||
>typeof b : string
|
||||
>typeof b : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>b : { toString(): string; }
|
||||
>"boolean" : "boolean"
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ var c: C;
|
||||
// - when false, removes the primitive type from the type of x.
|
||||
if (typeof strOrNum === "string") {
|
||||
>typeof strOrNum === "string" : boolean
|
||||
>typeof strOrNum : string
|
||||
>typeof strOrNum : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNum : string | number
|
||||
>"string" : "string"
|
||||
|
||||
@ -63,7 +63,7 @@ else {
|
||||
}
|
||||
if (typeof strOrBool === "string") {
|
||||
>typeof strOrBool === "string" : boolean
|
||||
>typeof strOrBool : string
|
||||
>typeof strOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrBool : string | boolean
|
||||
>"string" : "string"
|
||||
|
||||
@ -80,7 +80,7 @@ else {
|
||||
}
|
||||
if (typeof strOrNumOrBool === "string") {
|
||||
>typeof strOrNumOrBool === "string" : boolean
|
||||
>typeof strOrNumOrBool : string
|
||||
>typeof strOrNumOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBool : string | number | boolean
|
||||
>"string" : "string"
|
||||
|
||||
@ -97,7 +97,7 @@ else {
|
||||
}
|
||||
if (typeof strOrC === "string") {
|
||||
>typeof strOrC === "string" : boolean
|
||||
>typeof strOrC : string
|
||||
>typeof strOrC : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrC : string | C
|
||||
>"string" : "string"
|
||||
|
||||
@ -115,7 +115,7 @@ else {
|
||||
|
||||
if (typeof numOrBool === "string") {
|
||||
>typeof numOrBool === "string" : boolean
|
||||
>typeof numOrBool : string
|
||||
>typeof numOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>numOrBool : number | boolean
|
||||
>"string" : "string"
|
||||
|
||||
@ -134,7 +134,7 @@ else {
|
||||
// - when false, narrows the type of x by typeof x === s when true.
|
||||
if (typeof strOrNum !== "string") {
|
||||
>typeof strOrNum !== "string" : boolean
|
||||
>typeof strOrNum : string
|
||||
>typeof strOrNum : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNum : string | number
|
||||
>"string" : "string"
|
||||
|
||||
@ -151,7 +151,7 @@ else {
|
||||
}
|
||||
if (typeof strOrBool !== "string") {
|
||||
>typeof strOrBool !== "string" : boolean
|
||||
>typeof strOrBool : string
|
||||
>typeof strOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrBool : string | boolean
|
||||
>"string" : "string"
|
||||
|
||||
@ -168,7 +168,7 @@ else {
|
||||
}
|
||||
if (typeof strOrNumOrBool !== "string") {
|
||||
>typeof strOrNumOrBool !== "string" : boolean
|
||||
>typeof strOrNumOrBool : string
|
||||
>typeof strOrNumOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrNumOrBool : string | number | boolean
|
||||
>"string" : "string"
|
||||
|
||||
@ -185,7 +185,7 @@ else {
|
||||
}
|
||||
if (typeof strOrC !== "string") {
|
||||
>typeof strOrC !== "string" : boolean
|
||||
>typeof strOrC : string
|
||||
>typeof strOrC : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>strOrC : string | C
|
||||
>"string" : "string"
|
||||
|
||||
@ -203,7 +203,7 @@ else {
|
||||
|
||||
if (typeof numOrBool !== "string") {
|
||||
>typeof numOrBool !== "string" : boolean
|
||||
>typeof numOrBool : string
|
||||
>typeof numOrBool : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>numOrBool : number | boolean
|
||||
>"string" : "string"
|
||||
|
||||
|
||||
@ -7,11 +7,11 @@ var r1 = typeof x === "string" && typeof x === "string" ? x.substr : x.toFixed;
|
||||
>typeof x === "string" && typeof x === "string" ? x.substr : x.toFixed : (from: number, length?: number) => string
|
||||
>typeof x === "string" && typeof x === "string" : boolean
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string
|
||||
>"string" : "string"
|
||||
>x.substr : (from: number, length?: number) => string
|
||||
@ -28,11 +28,11 @@ var r2 = !(typeof x === "string" && typeof x === "string") ? x.toFixed : x.subst
|
||||
>(typeof x === "string" && typeof x === "string") : boolean
|
||||
>typeof x === "string" && typeof x === "string" : boolean
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string
|
||||
>"string" : "string"
|
||||
>x.toFixed : (fractionDigits?: number) => string
|
||||
@ -47,11 +47,11 @@ var r3 = typeof x === "string" || typeof x === "string" ? x.substr : x.toFixed;
|
||||
>typeof x === "string" || typeof x === "string" ? x.substr : x.toFixed : (from: number, length?: number) => string
|
||||
>typeof x === "string" || typeof x === "string" : boolean
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : number
|
||||
>"string" : "string"
|
||||
>x.substr : (from: number, length?: number) => string
|
||||
@ -68,11 +68,11 @@ var r4 = !(typeof x === "string" || typeof x === "string") ? x.toFixed : x.subst
|
||||
>(typeof x === "string" || typeof x === "string") : boolean
|
||||
>typeof x === "string" || typeof x === "string" : boolean
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : number
|
||||
>"string" : "string"
|
||||
>x.toFixed : (fractionDigits?: number) => string
|
||||
|
||||
@ -4,13 +4,13 @@ let stringOrNumber: string | number;
|
||||
|
||||
if (typeof stringOrNumber === "number") {
|
||||
>typeof stringOrNumber === "number" : boolean
|
||||
>typeof stringOrNumber : string
|
||||
>typeof stringOrNumber : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>stringOrNumber : string | number
|
||||
>"number" : "number"
|
||||
|
||||
if (typeof stringOrNumber !== "number") {
|
||||
>typeof stringOrNumber !== "number" : boolean
|
||||
>typeof stringOrNumber : string
|
||||
>typeof stringOrNumber : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>stringOrNumber : number
|
||||
>"number" : "number"
|
||||
|
||||
@ -22,11 +22,11 @@ if (typeof stringOrNumber === "number") {
|
||||
if (typeof stringOrNumber === "number" && typeof stringOrNumber !== "number") {
|
||||
>typeof stringOrNumber === "number" && typeof stringOrNumber !== "number" : boolean
|
||||
>typeof stringOrNumber === "number" : boolean
|
||||
>typeof stringOrNumber : string
|
||||
>typeof stringOrNumber : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>stringOrNumber : string | number
|
||||
>"number" : "number"
|
||||
>typeof stringOrNumber !== "number" : boolean
|
||||
>typeof stringOrNumber : string
|
||||
>typeof stringOrNumber : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>stringOrNumber : number
|
||||
>"number" : "number"
|
||||
|
||||
|
||||
@ -6,13 +6,13 @@ function test1(a: any) {
|
||||
|
||||
if (typeof a !== "undefined") {
|
||||
>typeof a !== "undefined" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : any
|
||||
>"undefined" : "undefined"
|
||||
|
||||
if (typeof a === "boolean") {
|
||||
>typeof a === "boolean" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : any
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -36,13 +36,13 @@ function test2(a: any) {
|
||||
|
||||
if (typeof a === "undefined") {
|
||||
>typeof a === "undefined" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : any
|
||||
>"undefined" : "undefined"
|
||||
|
||||
if (typeof a === "boolean") {
|
||||
>typeof a === "boolean" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : undefined
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -67,11 +67,11 @@ function test3(a: any) {
|
||||
if (typeof a === "undefined" || typeof a === "boolean") {
|
||||
>typeof a === "undefined" || typeof a === "boolean" : boolean
|
||||
>typeof a === "undefined" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : any
|
||||
>"undefined" : "undefined"
|
||||
>typeof a === "boolean" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : any
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -91,11 +91,11 @@ function test4(a: any) {
|
||||
if (typeof a !== "undefined" && typeof a === "boolean") {
|
||||
>typeof a !== "undefined" && typeof a === "boolean" : boolean
|
||||
>typeof a !== "undefined" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : any
|
||||
>"undefined" : "undefined"
|
||||
>typeof a === "boolean" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : any
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -114,13 +114,13 @@ function test5(a: boolean | void) {
|
||||
|
||||
if (typeof a !== "undefined") {
|
||||
>typeof a !== "undefined" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : boolean | void
|
||||
>"undefined" : "undefined"
|
||||
|
||||
if (typeof a === "boolean") {
|
||||
>typeof a === "boolean" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : boolean
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -144,13 +144,13 @@ function test6(a: boolean | void) {
|
||||
|
||||
if (typeof a === "undefined") {
|
||||
>typeof a === "undefined" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : boolean | void
|
||||
>"undefined" : "undefined"
|
||||
|
||||
if (typeof a === "boolean") {
|
||||
>typeof a === "boolean" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : boolean | void
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -175,11 +175,11 @@ function test7(a: boolean | void) {
|
||||
if (typeof a === "undefined" || typeof a === "boolean") {
|
||||
>typeof a === "undefined" || typeof a === "boolean" : boolean
|
||||
>typeof a === "undefined" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : boolean | void
|
||||
>"undefined" : "undefined"
|
||||
>typeof a === "boolean" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : boolean
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -199,11 +199,11 @@ function test8(a: boolean | void) {
|
||||
if (typeof a !== "undefined" && typeof a === "boolean") {
|
||||
>typeof a !== "undefined" && typeof a === "boolean" : boolean
|
||||
>typeof a !== "undefined" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : boolean | void
|
||||
>"undefined" : "undefined"
|
||||
>typeof a === "boolean" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : boolean
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -222,13 +222,13 @@ function test9(a: boolean | number) {
|
||||
|
||||
if (typeof a !== "undefined") {
|
||||
>typeof a !== "undefined" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : number | boolean
|
||||
>"undefined" : "undefined"
|
||||
|
||||
if (typeof a === "boolean") {
|
||||
>typeof a === "boolean" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : number | boolean
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -252,13 +252,13 @@ function test10(a: boolean | number) {
|
||||
|
||||
if (typeof a === "undefined") {
|
||||
>typeof a === "undefined" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : number | boolean
|
||||
>"undefined" : "undefined"
|
||||
|
||||
if (typeof a === "boolean") {
|
||||
>typeof a === "boolean" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : number | boolean
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -283,11 +283,11 @@ function test11(a: boolean | number) {
|
||||
if (typeof a === "undefined" || typeof a === "boolean") {
|
||||
>typeof a === "undefined" || typeof a === "boolean" : boolean
|
||||
>typeof a === "undefined" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : number | boolean
|
||||
>"undefined" : "undefined"
|
||||
>typeof a === "boolean" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : number | boolean
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -307,11 +307,11 @@ function test12(a: boolean | number) {
|
||||
if (typeof a !== "undefined" && typeof a === "boolean") {
|
||||
>typeof a !== "undefined" && typeof a === "boolean" : boolean
|
||||
>typeof a !== "undefined" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : number | boolean
|
||||
>"undefined" : "undefined"
|
||||
>typeof a === "boolean" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : number | boolean
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -330,13 +330,13 @@ function test13(a: boolean | number | void) {
|
||||
|
||||
if (typeof a !== "undefined") {
|
||||
>typeof a !== "undefined" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : number | boolean | void
|
||||
>"undefined" : "undefined"
|
||||
|
||||
if (typeof a === "boolean") {
|
||||
>typeof a === "boolean" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : number | boolean
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -360,13 +360,13 @@ function test14(a: boolean | number | void) {
|
||||
|
||||
if (typeof a === "undefined") {
|
||||
>typeof a === "undefined" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : number | boolean | void
|
||||
>"undefined" : "undefined"
|
||||
|
||||
if (typeof a === "boolean") {
|
||||
>typeof a === "boolean" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : number | boolean | void
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -391,11 +391,11 @@ function test15(a: boolean | number | void) {
|
||||
if (typeof a === "undefined" || typeof a === "boolean") {
|
||||
>typeof a === "undefined" || typeof a === "boolean" : boolean
|
||||
>typeof a === "undefined" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : number | boolean | void
|
||||
>"undefined" : "undefined"
|
||||
>typeof a === "boolean" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : number | boolean
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -415,11 +415,11 @@ function test16(a: boolean | number | void) {
|
||||
if (typeof a !== "undefined" && typeof a === "boolean") {
|
||||
>typeof a !== "undefined" && typeof a === "boolean" : boolean
|
||||
>typeof a !== "undefined" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : number | boolean | void
|
||||
>"undefined" : "undefined"
|
||||
>typeof a === "boolean" : boolean
|
||||
>typeof a : string
|
||||
>typeof a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>a : number | boolean
|
||||
>"boolean" : "boolean"
|
||||
|
||||
|
||||
@ -118,7 +118,7 @@ function foo1() {
|
||||
>x : string | number | boolean
|
||||
>typeof x === "string" ? x.slice() : "abc" : string
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
>x.slice() : string
|
||||
@ -152,7 +152,7 @@ function foo2() {
|
||||
|
||||
if (typeof x === "string") {
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
|
||||
@ -211,7 +211,7 @@ function f2() {
|
||||
|
||||
if (typeof x === "string") {
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : undefined
|
||||
>"string" : "string"
|
||||
|
||||
@ -254,7 +254,7 @@ function f4() {
|
||||
|
||||
if (typeof x === "boolean") {
|
||||
>typeof x === "boolean" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : undefined
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -272,11 +272,11 @@ function f5(x: string | number) {
|
||||
if (typeof x === "string" && typeof x === "number") {
|
||||
>typeof x === "string" && typeof x === "number" : boolean
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
>typeof x === "number" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string
|
||||
>"number" : "number"
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ class ClassWithAccessors {
|
||||
>num : number
|
||||
>typeof var1 === "string" && var1.length : number
|
||||
>typeof var1 === "string" : boolean
|
||||
>typeof var1 : string
|
||||
>typeof var1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var1 : string | number
|
||||
>"string" : "string"
|
||||
>var1.length : number
|
||||
@ -42,7 +42,7 @@ class ClassWithAccessors {
|
||||
>num : number
|
||||
>typeof var2 === "string" && var2.length : number
|
||||
>typeof var2 === "string" : boolean
|
||||
>typeof var2 : string
|
||||
>typeof var2 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var2 : string | number
|
||||
>"string" : "string"
|
||||
>var2.length : number
|
||||
@ -63,7 +63,7 @@ class ClassWithAccessors {
|
||||
>num : number
|
||||
>typeof var1 === "string" && var1.length : number
|
||||
>typeof var1 === "string" : boolean
|
||||
>typeof var1 : string
|
||||
>typeof var1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var1 : string | number
|
||||
>"string" : "string"
|
||||
>var1.length : number
|
||||
@ -76,7 +76,7 @@ class ClassWithAccessors {
|
||||
>num : number
|
||||
>typeof param === "string" && param.length : number
|
||||
>typeof param === "string" : boolean
|
||||
>typeof param : string
|
||||
>typeof param : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>param : string | number
|
||||
>"string" : "string"
|
||||
>param.length : number
|
||||
@ -92,7 +92,7 @@ class ClassWithAccessors {
|
||||
>num : number
|
||||
>typeof var2 === "string" && var2.length : number
|
||||
>typeof var2 === "string" : boolean
|
||||
>typeof var2 : string
|
||||
>typeof var2 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var2 : string | number
|
||||
>"string" : "string"
|
||||
>var2.length : number
|
||||
@ -109,7 +109,7 @@ class ClassWithAccessors {
|
||||
>num : number
|
||||
>typeof var1 === "string" && var1.length : number
|
||||
>typeof var1 === "string" : boolean
|
||||
>typeof var1 : string
|
||||
>typeof var1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var1 : string | number
|
||||
>"string" : "string"
|
||||
>var1.length : number
|
||||
@ -125,7 +125,7 @@ class ClassWithAccessors {
|
||||
>num : number
|
||||
>typeof var2 === "string" && var2.length : number
|
||||
>typeof var2 === "string" : boolean
|
||||
>typeof var2 : string
|
||||
>typeof var2 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var2 : string | number
|
||||
>"string" : "string"
|
||||
>var2.length : number
|
||||
@ -146,7 +146,7 @@ class ClassWithAccessors {
|
||||
>num : number
|
||||
>typeof var1 === "string" && var1.length : number
|
||||
>typeof var1 === "string" : boolean
|
||||
>typeof var1 : string
|
||||
>typeof var1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var1 : string | number
|
||||
>"string" : "string"
|
||||
>var1.length : number
|
||||
@ -159,7 +159,7 @@ class ClassWithAccessors {
|
||||
>num : number
|
||||
>typeof param === "string" && param.length : number
|
||||
>typeof param === "string" : boolean
|
||||
>typeof param : string
|
||||
>typeof param : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>param : string | number
|
||||
>"string" : "string"
|
||||
>param.length : number
|
||||
@ -175,7 +175,7 @@ class ClassWithAccessors {
|
||||
>num : number
|
||||
>typeof var2 === "string" && var2.length : number
|
||||
>typeof var2 === "string" : boolean
|
||||
>typeof var2 : string
|
||||
>typeof var2 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var2 : string | number
|
||||
>"string" : "string"
|
||||
>var2.length : number
|
||||
@ -192,7 +192,7 @@ class ClassWithAccessors {
|
||||
>num : number
|
||||
>typeof var1 === "string" && var1.length : number
|
||||
>typeof var1 === "string" : boolean
|
||||
>typeof var1 : string
|
||||
>typeof var1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var1 : string | number
|
||||
>"string" : "string"
|
||||
>var1.length : number
|
||||
@ -208,7 +208,7 @@ class ClassWithAccessors {
|
||||
>num : number
|
||||
>typeof var2 === "string" && var2.length : number
|
||||
>typeof var2 === "string" : boolean
|
||||
>typeof var2 : string
|
||||
>typeof var2 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var2 : string | number
|
||||
>"string" : "string"
|
||||
>var2.length : number
|
||||
@ -229,7 +229,7 @@ class ClassWithAccessors {
|
||||
>num : number
|
||||
>typeof var1 === "string" && var1.length : number
|
||||
>typeof var1 === "string" : boolean
|
||||
>typeof var1 : string
|
||||
>typeof var1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var1 : string | number
|
||||
>"string" : "string"
|
||||
>var1.length : number
|
||||
@ -242,7 +242,7 @@ class ClassWithAccessors {
|
||||
>num : number
|
||||
>typeof param === "string" && param.length : number
|
||||
>typeof param === "string" : boolean
|
||||
>typeof param : string
|
||||
>typeof param : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>param : string | number
|
||||
>"string" : "string"
|
||||
>param.length : number
|
||||
@ -258,7 +258,7 @@ class ClassWithAccessors {
|
||||
>num : number
|
||||
>typeof var2 === "string" && var2.length : number
|
||||
>typeof var2 === "string" : boolean
|
||||
>typeof var2 : string
|
||||
>typeof var2 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var2 : string | number
|
||||
>"string" : "string"
|
||||
>var2.length : number
|
||||
@ -275,7 +275,7 @@ class ClassWithAccessors {
|
||||
>num : number
|
||||
>typeof var1 === "string" && var1.length : number
|
||||
>typeof var1 === "string" : boolean
|
||||
>typeof var1 : string
|
||||
>typeof var1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var1 : string | number
|
||||
>"string" : "string"
|
||||
>var1.length : number
|
||||
@ -291,7 +291,7 @@ class ClassWithAccessors {
|
||||
>num : number
|
||||
>typeof var2 === "string" && var2.length : number
|
||||
>typeof var2 === "string" : boolean
|
||||
>typeof var2 : string
|
||||
>typeof var2 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var2 : string | number
|
||||
>"string" : "string"
|
||||
>var2.length : number
|
||||
@ -312,7 +312,7 @@ class ClassWithAccessors {
|
||||
>num : number
|
||||
>typeof var1 === "string" && var1.length : number
|
||||
>typeof var1 === "string" : boolean
|
||||
>typeof var1 : string
|
||||
>typeof var1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var1 : string | number
|
||||
>"string" : "string"
|
||||
>var1.length : number
|
||||
@ -325,7 +325,7 @@ class ClassWithAccessors {
|
||||
>num : number
|
||||
>typeof param === "string" && param.length : number
|
||||
>typeof param === "string" : boolean
|
||||
>typeof param : string
|
||||
>typeof param : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>param : string | number
|
||||
>"string" : "string"
|
||||
>param.length : number
|
||||
@ -341,7 +341,7 @@ class ClassWithAccessors {
|
||||
>num : number
|
||||
>typeof var2 === "string" && var2.length : number
|
||||
>typeof var2 === "string" : boolean
|
||||
>typeof var2 : string
|
||||
>typeof var2 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var2 : string | number
|
||||
>"string" : "string"
|
||||
>var2.length : number
|
||||
|
||||
@ -21,7 +21,7 @@ class C1 {
|
||||
>num : number
|
||||
>typeof var1 === "string" && var1.length : number
|
||||
>typeof var1 === "string" : boolean
|
||||
>typeof var1 : string
|
||||
>typeof var1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var1 : string | number
|
||||
>"string" : "string"
|
||||
>var1.length : number
|
||||
@ -37,7 +37,7 @@ class C1 {
|
||||
>num : number
|
||||
>typeof var2 === "string" && var2.length : number
|
||||
>typeof var2 === "string" : boolean
|
||||
>typeof var2 : string
|
||||
>typeof var2 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var2 : string | number
|
||||
>"string" : "string"
|
||||
>var2.length : number
|
||||
@ -50,7 +50,7 @@ class C1 {
|
||||
>num : number
|
||||
>typeof param === "string" && param.length : number
|
||||
>typeof param === "string" : boolean
|
||||
>typeof param : string
|
||||
>typeof param : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>param : string | number
|
||||
>"string" : "string"
|
||||
>param.length : number
|
||||
@ -68,7 +68,7 @@ class C1 {
|
||||
>num : number
|
||||
>typeof var1 === "string" && var1.length : number
|
||||
>typeof var1 === "string" : boolean
|
||||
>typeof var1 : string
|
||||
>typeof var1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var1 : string | number
|
||||
>"string" : "string"
|
||||
>var1.length : number
|
||||
@ -84,7 +84,7 @@ class C1 {
|
||||
>num : number
|
||||
>typeof var2 === "string" && var2.length : number
|
||||
>typeof var2 === "string" : boolean
|
||||
>typeof var2 : string
|
||||
>typeof var2 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var2 : string | number
|
||||
>"string" : "string"
|
||||
>var2.length : number
|
||||
@ -97,7 +97,7 @@ class C1 {
|
||||
>num : number
|
||||
>typeof param === "string" && param.length : number
|
||||
>typeof param === "string" : boolean
|
||||
>typeof param : string
|
||||
>typeof param : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>param : string | number
|
||||
>"string" : "string"
|
||||
>param.length : number
|
||||
@ -115,7 +115,7 @@ class C1 {
|
||||
>num : number
|
||||
>typeof var1 === "string" && var1.length : number
|
||||
>typeof var1 === "string" : boolean
|
||||
>typeof var1 : string
|
||||
>typeof var1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var1 : string | number
|
||||
>"string" : "string"
|
||||
>var1.length : number
|
||||
@ -131,7 +131,7 @@ class C1 {
|
||||
>num : number
|
||||
>typeof var2 === "string" && var2.length : number
|
||||
>typeof var2 === "string" : boolean
|
||||
>typeof var2 : string
|
||||
>typeof var2 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var2 : string | number
|
||||
>"string" : "string"
|
||||
>var2.length : number
|
||||
@ -144,7 +144,7 @@ class C1 {
|
||||
>num : number
|
||||
>typeof param === "string" && param.length : number
|
||||
>typeof param === "string" : boolean
|
||||
>typeof param : string
|
||||
>typeof param : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>param : string | number
|
||||
>"string" : "string"
|
||||
>param.length : number
|
||||
@ -162,7 +162,7 @@ class C1 {
|
||||
>num : number
|
||||
>typeof var1 === "string" && var1.length : number
|
||||
>typeof var1 === "string" : boolean
|
||||
>typeof var1 : string
|
||||
>typeof var1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var1 : string | number
|
||||
>"string" : "string"
|
||||
>var1.length : number
|
||||
@ -178,7 +178,7 @@ class C1 {
|
||||
>num : number
|
||||
>typeof var2 === "string" && var2.length : number
|
||||
>typeof var2 === "string" : boolean
|
||||
>typeof var2 : string
|
||||
>typeof var2 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var2 : string | number
|
||||
>"string" : "string"
|
||||
>var2.length : number
|
||||
@ -191,7 +191,7 @@ class C1 {
|
||||
>num : number
|
||||
>typeof param === "string" && param.length : number
|
||||
>typeof param === "string" : boolean
|
||||
>typeof param : string
|
||||
>typeof param : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>param : string | number
|
||||
>"string" : "string"
|
||||
>param.length : number
|
||||
@ -209,7 +209,7 @@ class C1 {
|
||||
>num : number
|
||||
>typeof var1 === "string" && var1.length : number
|
||||
>typeof var1 === "string" : boolean
|
||||
>typeof var1 : string
|
||||
>typeof var1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var1 : string | number
|
||||
>"string" : "string"
|
||||
>var1.length : number
|
||||
@ -225,7 +225,7 @@ class C1 {
|
||||
>num : number
|
||||
>typeof var2 === "string" && var2.length : number
|
||||
>typeof var2 === "string" : boolean
|
||||
>typeof var2 : string
|
||||
>typeof var2 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var2 : string | number
|
||||
>"string" : "string"
|
||||
>var2.length : number
|
||||
@ -238,7 +238,7 @@ class C1 {
|
||||
>num : number
|
||||
>typeof param === "string" && param.length : number
|
||||
>typeof param === "string" : boolean
|
||||
>typeof param : string
|
||||
>typeof param : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>param : string | number
|
||||
>"string" : "string"
|
||||
>param.length : number
|
||||
|
||||
@ -13,7 +13,7 @@ function foo(x: number | string) {
|
||||
return typeof x === "string"
|
||||
>typeof x === "string" ? x.length // string : x++ : number
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
|
||||
@ -33,7 +33,7 @@ function foo2(x: number | string) {
|
||||
return typeof x === "string"
|
||||
>typeof x === "string" ? ((x = "hello") && x) // string : x : string | number
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
|
||||
@ -56,7 +56,7 @@ function foo3(x: number | string) {
|
||||
return typeof x === "string"
|
||||
>typeof x === "string" ? ((x = 10) && x) // number : x : number
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
|
||||
@ -79,7 +79,7 @@ function foo4(x: number | string) {
|
||||
return typeof x === "string"
|
||||
>typeof x === "string" ? x // string : ((x = 10) && x) : string | number
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
|
||||
@ -102,7 +102,7 @@ function foo5(x: number | string) {
|
||||
return typeof x === "string"
|
||||
>typeof x === "string" ? x // string : ((x = "hello") && x) : string
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
|
||||
@ -126,7 +126,7 @@ function foo6(x: number | string) {
|
||||
return typeof x === "string"
|
||||
>typeof x === "string" ? ((x = 10) && x) // number : ((x = "hello") && x) : string | number
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
|
||||
@ -155,7 +155,7 @@ function foo7(x: number | string | boolean) {
|
||||
return typeof x === "string"
|
||||
>typeof x === "string" ? x === "hello" // boolean : typeof x === "boolean" ? x // boolean : x == 10 : boolean
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number | boolean
|
||||
>"string" : "string"
|
||||
|
||||
@ -167,7 +167,7 @@ function foo7(x: number | string | boolean) {
|
||||
: typeof x === "boolean"
|
||||
>typeof x === "boolean" ? x // boolean : x == 10 : boolean
|
||||
>typeof x === "boolean" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : number | boolean
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -189,7 +189,7 @@ function foo8(x: number | string | boolean) {
|
||||
return typeof x === "string"
|
||||
>typeof x === "string" ? x === "hello" : ((b = x) && // number | boolean (typeof x === "boolean" ? x // boolean : x == 10)) : boolean
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number | boolean
|
||||
>"string" : "string"
|
||||
|
||||
@ -210,7 +210,7 @@ function foo8(x: number | string | boolean) {
|
||||
>(typeof x === "boolean" ? x // boolean : x == 10) : boolean
|
||||
>typeof x === "boolean" ? x // boolean : x == 10 : boolean
|
||||
>typeof x === "boolean" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : number | boolean
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -234,7 +234,7 @@ function foo9(x: number | string) {
|
||||
return typeof x === "string"
|
||||
>typeof x === "string" ? ((y = x.length) && x === "hello") // boolean : x === 10 : boolean
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
|
||||
@ -267,7 +267,7 @@ function foo10(x: number | string | boolean) {
|
||||
return typeof x === "string"
|
||||
>typeof x === "string" ? x // string : ((b = x) // x is number | boolean && typeof x === "number" && x.toString()) : string
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number | boolean
|
||||
>"string" : "string"
|
||||
|
||||
@ -285,7 +285,7 @@ function foo10(x: number | string | boolean) {
|
||||
|
||||
&& typeof x === "number"
|
||||
>typeof x === "number" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : number | boolean
|
||||
>"number" : "number"
|
||||
|
||||
@ -306,7 +306,7 @@ function foo11(x: number | string | boolean) {
|
||||
return typeof x === "string"
|
||||
>typeof x === "string" ? x // string : ((b = x) // x is number | boolean && typeof x === "number" && (x = 10) // assignment to x && x) : string | number
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number | boolean
|
||||
>"string" : "string"
|
||||
|
||||
@ -325,7 +325,7 @@ function foo11(x: number | string | boolean) {
|
||||
|
||||
&& typeof x === "number"
|
||||
>typeof x === "number" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : number | boolean
|
||||
>"number" : "number"
|
||||
|
||||
@ -349,7 +349,7 @@ function foo12(x: number | string | boolean) {
|
||||
return typeof x === "string"
|
||||
>typeof x === "string" ? ((x = 10) && x.toString().length) // number : ((b = x) // x is number | boolean && typeof x === "number" && x) : number
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number | boolean
|
||||
>"string" : "string"
|
||||
|
||||
@ -378,7 +378,7 @@ function foo12(x: number | string | boolean) {
|
||||
|
||||
&& typeof x === "number"
|
||||
>typeof x === "number" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : number | boolean
|
||||
>"number" : "number"
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ function a(x: string | number | boolean) {
|
||||
|
||||
} while (typeof x === "string")
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number | boolean
|
||||
>"string" : "string"
|
||||
|
||||
@ -52,7 +52,7 @@ function b(x: string | number | boolean) {
|
||||
|
||||
} while (typeof x === "string")
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number | boolean
|
||||
>"string" : "string"
|
||||
|
||||
@ -82,7 +82,7 @@ function c(x: string | number) {
|
||||
|
||||
} while (typeof x === "string")
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ var var1: string | number;
|
||||
|
||||
if (typeof var1 === "string") {
|
||||
>typeof var1 === "string" : boolean
|
||||
>typeof var1 : string
|
||||
>typeof var1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var1 : string | number
|
||||
>"string" : "string"
|
||||
|
||||
@ -38,7 +38,7 @@ export var var2: string | number;
|
||||
|
||||
if (typeof var2 === "string") {
|
||||
>typeof var2 === "string" : boolean
|
||||
>typeof var2 : string
|
||||
>typeof var2 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var2 : string | number
|
||||
>"string" : "string"
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ function a(x: string | number) {
|
||||
>x : string | number
|
||||
>undefined : undefined
|
||||
>typeof x !== "number" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"number" : "number"
|
||||
>x = undefined : undefined
|
||||
@ -33,7 +33,7 @@ function b(x: string | number) {
|
||||
>x : string | number
|
||||
>undefined : undefined
|
||||
>typeof x !== "number" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"number" : "number"
|
||||
>x = undefined : undefined
|
||||
@ -58,7 +58,7 @@ function c(x: string | number) {
|
||||
>x : string | number
|
||||
>undefined : undefined
|
||||
>typeof x !== "number" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"number" : "number"
|
||||
>x = undefined : undefined
|
||||
|
||||
@ -20,7 +20,7 @@ function f(param: string | number) {
|
||||
>num : number
|
||||
>typeof var1 === "string" && var1.length : number
|
||||
>typeof var1 === "string" : boolean
|
||||
>typeof var1 : string
|
||||
>typeof var1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var1 : string | number
|
||||
>"string" : "string"
|
||||
>var1.length : number
|
||||
@ -36,7 +36,7 @@ function f(param: string | number) {
|
||||
>num : number
|
||||
>typeof var2 === "string" && var2.length : number
|
||||
>typeof var2 === "string" : boolean
|
||||
>typeof var2 : string
|
||||
>typeof var2 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var2 : string | number
|
||||
>"string" : "string"
|
||||
>var2.length : number
|
||||
@ -49,7 +49,7 @@ function f(param: string | number) {
|
||||
>num : number
|
||||
>typeof param === "string" && param.length : number
|
||||
>typeof param === "string" : boolean
|
||||
>typeof param : string
|
||||
>typeof param : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>param : string | number
|
||||
>"string" : "string"
|
||||
>param.length : number
|
||||
@ -74,7 +74,7 @@ function f1(param: string | number) {
|
||||
>num : number
|
||||
>typeof var1 === "string" && var1.length : number
|
||||
>typeof var1 === "string" : boolean
|
||||
>typeof var1 : string
|
||||
>typeof var1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var1 : string | number
|
||||
>"string" : "string"
|
||||
>var1.length : number
|
||||
@ -87,7 +87,7 @@ function f1(param: string | number) {
|
||||
>num : number
|
||||
>typeof var2 === "string" && var2.length : number
|
||||
>typeof var2 === "string" : boolean
|
||||
>typeof var2 : string
|
||||
>typeof var2 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var2 : string | number
|
||||
>"string" : "string"
|
||||
>var2.length : number
|
||||
@ -100,7 +100,7 @@ function f1(param: string | number) {
|
||||
>num : number
|
||||
>typeof param === "string" && param.length : number
|
||||
>typeof param === "string" : boolean
|
||||
>typeof param : string
|
||||
>typeof param : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>param : string | number
|
||||
>"string" : "string"
|
||||
>param.length : number
|
||||
@ -116,7 +116,7 @@ function f1(param: string | number) {
|
||||
>num : number
|
||||
>typeof var3 === "string" && var3.length : number
|
||||
>typeof var3 === "string" : boolean
|
||||
>typeof var3 : string
|
||||
>typeof var3 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var3 : string | number
|
||||
>"string" : "string"
|
||||
>var3.length : number
|
||||
@ -128,7 +128,7 @@ function f1(param: string | number) {
|
||||
>num : number
|
||||
>typeof param1 === "string" && param1.length : number
|
||||
>typeof param1 === "string" : boolean
|
||||
>typeof param1 : string
|
||||
>typeof param1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>param1 : string | number
|
||||
>"string" : "string"
|
||||
>param1.length : number
|
||||
@ -158,7 +158,7 @@ function f2(param: string | number) {
|
||||
>num : number
|
||||
>typeof var1 === "string" && var1.length : number
|
||||
>typeof var1 === "string" : boolean
|
||||
>typeof var1 : string
|
||||
>typeof var1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var1 : string | number
|
||||
>"string" : "string"
|
||||
>var1.length : number
|
||||
@ -171,7 +171,7 @@ function f2(param: string | number) {
|
||||
>num : number
|
||||
>typeof var2 === "string" && var2.length : number
|
||||
>typeof var2 === "string" : boolean
|
||||
>typeof var2 : string
|
||||
>typeof var2 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var2 : string | number
|
||||
>"string" : "string"
|
||||
>var2.length : number
|
||||
@ -184,7 +184,7 @@ function f2(param: string | number) {
|
||||
>num : number
|
||||
>typeof param === "string" && param.length : number
|
||||
>typeof param === "string" : boolean
|
||||
>typeof param : string
|
||||
>typeof param : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>param : string | number
|
||||
>"string" : "string"
|
||||
>param.length : number
|
||||
@ -200,7 +200,7 @@ function f2(param: string | number) {
|
||||
>num : number
|
||||
>typeof var3 === "string" && var3.length : number
|
||||
>typeof var3 === "string" : boolean
|
||||
>typeof var3 : string
|
||||
>typeof var3 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var3 : string | number
|
||||
>"string" : "string"
|
||||
>var3.length : number
|
||||
@ -212,7 +212,7 @@ function f2(param: string | number) {
|
||||
>num : number
|
||||
>typeof param1 === "string" && param1.length : number
|
||||
>typeof param1 === "string" : boolean
|
||||
>typeof param1 : string
|
||||
>typeof param1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>param1 : string | number
|
||||
>"string" : "string"
|
||||
>param1.length : number
|
||||
@ -245,7 +245,7 @@ function f3(param: string | number) {
|
||||
>num : number
|
||||
>typeof var1 === "string" && var1.length : number
|
||||
>typeof var1 === "string" : boolean
|
||||
>typeof var1 : string
|
||||
>typeof var1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var1 : string | number
|
||||
>"string" : "string"
|
||||
>var1.length : number
|
||||
@ -258,7 +258,7 @@ function f3(param: string | number) {
|
||||
>num : number
|
||||
>typeof var2 === "string" && var2.length : number
|
||||
>typeof var2 === "string" : boolean
|
||||
>typeof var2 : string
|
||||
>typeof var2 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var2 : string | number
|
||||
>"string" : "string"
|
||||
>var2.length : number
|
||||
@ -271,7 +271,7 @@ function f3(param: string | number) {
|
||||
>num : number
|
||||
>typeof param === "string" && param.length : number
|
||||
>typeof param === "string" : boolean
|
||||
>typeof param : string
|
||||
>typeof param : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>param : string | number
|
||||
>"string" : "string"
|
||||
>param.length : number
|
||||
@ -287,7 +287,7 @@ function f3(param: string | number) {
|
||||
>num : number
|
||||
>typeof var3 === "string" && var3.length : number
|
||||
>typeof var3 === "string" : boolean
|
||||
>typeof var3 : string
|
||||
>typeof var3 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var3 : string | number
|
||||
>"string" : "string"
|
||||
>var3.length : number
|
||||
@ -299,7 +299,7 @@ function f3(param: string | number) {
|
||||
>num : number
|
||||
>typeof param1 === "string" && param1.length : number
|
||||
>typeof param1 === "string" : boolean
|
||||
>typeof param1 : string
|
||||
>typeof param1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>param1 : string | number
|
||||
>"string" : "string"
|
||||
>param1.length : number
|
||||
@ -329,7 +329,7 @@ strOrNum = typeof f4() === "string" && f4(); // string | number
|
||||
>strOrNum : string | number
|
||||
>typeof f4() === "string" && f4() : string | number
|
||||
>typeof f4() === "string" : boolean
|
||||
>typeof f4() : string
|
||||
>typeof f4() : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>f4() : string | number
|
||||
>f4 : () => string | number
|
||||
>"string" : "string"
|
||||
|
||||
@ -8,7 +8,7 @@ function foo(x: number | string | boolean) {
|
||||
return typeof x === "string"
|
||||
>typeof x === "string" ? x : function f() { var b = x; // number | boolean return typeof x === "boolean" ? x.toString() // boolean : x.toString(); // number } () : string
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number | boolean
|
||||
>"string" : "string"
|
||||
|
||||
@ -27,7 +27,7 @@ function foo(x: number | string | boolean) {
|
||||
return typeof x === "boolean"
|
||||
>typeof x === "boolean" ? x.toString() // boolean : x.toString() : string
|
||||
>typeof x === "boolean" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : number | boolean
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -52,7 +52,7 @@ function foo2(x: number | string | boolean) {
|
||||
return typeof x === "string"
|
||||
>typeof x === "string" ? x : function f(a: number | boolean) { var b = x; // new scope - number | boolean return typeof x === "boolean" ? x.toString() // boolean : x.toString(); // number } (x) : string
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number | boolean
|
||||
>"string" : "string"
|
||||
|
||||
@ -72,7 +72,7 @@ function foo2(x: number | string | boolean) {
|
||||
return typeof x === "boolean"
|
||||
>typeof x === "boolean" ? x.toString() // boolean : x.toString() : string
|
||||
>typeof x === "boolean" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : number | boolean
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -98,7 +98,7 @@ function foo3(x: number | string | boolean) {
|
||||
return typeof x === "string"
|
||||
>typeof x === "string" ? x : (() => { var b = x; // new scope - number | boolean return typeof x === "boolean" ? x.toString() // boolean : x.toString(); // number })() : string
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number | boolean
|
||||
>"string" : "string"
|
||||
|
||||
@ -117,7 +117,7 @@ function foo3(x: number | string | boolean) {
|
||||
return typeof x === "boolean"
|
||||
>typeof x === "boolean" ? x.toString() // boolean : x.toString() : string
|
||||
>typeof x === "boolean" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : number | boolean
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -142,7 +142,7 @@ function foo4(x: number | string | boolean) {
|
||||
return typeof x === "string"
|
||||
>typeof x === "string" ? x : ((a: number | boolean) => { var b = x; // new scope - number | boolean return typeof x === "boolean" ? x.toString() // boolean : x.toString(); // number })(x) : string
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number | boolean
|
||||
>"string" : "string"
|
||||
|
||||
@ -162,7 +162,7 @@ function foo4(x: number | string | boolean) {
|
||||
return typeof x === "boolean"
|
||||
>typeof x === "boolean" ? x.toString() // boolean : x.toString() : string
|
||||
>typeof x === "boolean" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : number | boolean
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -188,7 +188,7 @@ function foo5(x: number | string | boolean) {
|
||||
|
||||
if (typeof x === "string") {
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number | boolean
|
||||
>"string" : "string"
|
||||
|
||||
@ -223,7 +223,7 @@ module m {
|
||||
|
||||
if (typeof x === "string") {
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number | boolean
|
||||
>"string" : "string"
|
||||
|
||||
@ -238,7 +238,7 @@ module m {
|
||||
>y : string
|
||||
>typeof x === "boolean" ? x.toString() // boolean : x.toString() : string
|
||||
>typeof x === "boolean" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : number | boolean
|
||||
>"boolean" : "boolean"
|
||||
|
||||
@ -275,7 +275,7 @@ module m1 {
|
||||
|
||||
if (typeof x === "string") {
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number | boolean
|
||||
>"string" : "string"
|
||||
|
||||
@ -290,7 +290,7 @@ module m1 {
|
||||
>y : string
|
||||
>typeof x === "boolean" ? x.toString() // boolean : x.toString() : string
|
||||
>typeof x === "boolean" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : number | boolean
|
||||
>"boolean" : "boolean"
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ var var1: string | number;
|
||||
|
||||
if (typeof var1 === "string") {
|
||||
>typeof var1 === "string" : boolean
|
||||
>typeof var1 : string
|
||||
>typeof var1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var1 : string | number
|
||||
>"string" : "string"
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ module m1 {
|
||||
>num : number
|
||||
>typeof var1 === "string" && var1.length : number
|
||||
>typeof var1 === "string" : boolean
|
||||
>typeof var1 : string
|
||||
>typeof var1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var1 : string | number
|
||||
>"string" : "string"
|
||||
>var1.length : number
|
||||
@ -35,7 +35,7 @@ module m1 {
|
||||
|
||||
if (typeof var2 === "string") {
|
||||
>typeof var2 === "string" : boolean
|
||||
>typeof var2 : string
|
||||
>typeof var2 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var2 : string | number
|
||||
>"string" : "string"
|
||||
|
||||
@ -59,7 +59,7 @@ module m1 {
|
||||
|
||||
if (typeof var3 === "string") {
|
||||
>typeof var3 === "string" : boolean
|
||||
>typeof var3 : string
|
||||
>typeof var3 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var3 : string | number
|
||||
>"string" : "string"
|
||||
|
||||
@ -94,7 +94,7 @@ module m2 {
|
||||
>num : number
|
||||
>typeof var1 === "string" && var1.length : number
|
||||
>typeof var1 === "string" : boolean
|
||||
>typeof var1 : string
|
||||
>typeof var1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var1 : string | number
|
||||
>"string" : "string"
|
||||
>var1.length : number
|
||||
@ -107,7 +107,7 @@ module m2 {
|
||||
>num : number
|
||||
>typeof var2 === "string" && var2.length : number
|
||||
>typeof var2 === "string" : boolean
|
||||
>typeof var2 : string
|
||||
>typeof var2 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var2 : string | number
|
||||
>"string" : "string"
|
||||
>var2.length : number
|
||||
@ -120,7 +120,7 @@ module m2 {
|
||||
>strOrNum : string | number
|
||||
>typeof var3 === "string" && var3 : string
|
||||
>typeof var3 === "string" : boolean
|
||||
>typeof var3 : string
|
||||
>typeof var3 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var3 : string | number
|
||||
>"string" : "string"
|
||||
>var3 : string
|
||||
@ -131,7 +131,7 @@ module m2 {
|
||||
|
||||
if (typeof var4 === "string") {
|
||||
>typeof var4 === "string" : boolean
|
||||
>typeof var4 : string
|
||||
>typeof var4 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var4 : string | number
|
||||
>"string" : "string"
|
||||
|
||||
@ -155,7 +155,7 @@ module m2 {
|
||||
|
||||
if (typeof var5 === "string") {
|
||||
>typeof var5 === "string" : boolean
|
||||
>typeof var5 : string
|
||||
>typeof var5 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var5 : string | number
|
||||
>"string" : "string"
|
||||
|
||||
@ -183,7 +183,7 @@ module m3.m4 {
|
||||
>num : number
|
||||
>typeof var1 === "string" && var1.length : number
|
||||
>typeof var1 === "string" : boolean
|
||||
>typeof var1 : string
|
||||
>typeof var1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var1 : string | number
|
||||
>"string" : "string"
|
||||
>var1.length : number
|
||||
@ -196,7 +196,7 @@ module m3.m4 {
|
||||
|
||||
if (typeof var2 === "string") {
|
||||
>typeof var2 === "string" : boolean
|
||||
>typeof var2 : string
|
||||
>typeof var2 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var2 : string | number
|
||||
>"string" : "string"
|
||||
|
||||
@ -220,7 +220,7 @@ module m3.m4 {
|
||||
|
||||
if (typeof var3 === "string") {
|
||||
>typeof var3 === "string" : boolean
|
||||
>typeof var3 : string
|
||||
>typeof var3 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var3 : string | number
|
||||
>"string" : "string"
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ class C1 {
|
||||
>strOrNum : string | number
|
||||
>typeof this.pp1 === "string" && this.pp1 : string
|
||||
>typeof this.pp1 === "string" : boolean
|
||||
>typeof this.pp1 : string
|
||||
>typeof this.pp1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>this.pp1 : string | number
|
||||
>this : this
|
||||
>pp1 : string | number
|
||||
@ -47,7 +47,7 @@ class C1 {
|
||||
>strOrNum : string | number
|
||||
>typeof this.pp2 === "string" && this.pp2 : string
|
||||
>typeof this.pp2 === "string" : boolean
|
||||
>typeof this.pp2 : string
|
||||
>typeof this.pp2 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>this.pp2 : string | number
|
||||
>this : this
|
||||
>pp2 : string | number
|
||||
@ -61,7 +61,7 @@ class C1 {
|
||||
>strOrNum : string | number
|
||||
>typeof this.pp3 === "string" && this.pp3 : string
|
||||
>typeof this.pp3 === "string" : boolean
|
||||
>typeof this.pp3 : string
|
||||
>typeof this.pp3 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>this.pp3 : string | number
|
||||
>this : this
|
||||
>pp3 : string | number
|
||||
@ -80,7 +80,7 @@ strOrNum = typeof c1.pp2 === "string" && c1.pp2; // string | number
|
||||
>strOrNum : string | number
|
||||
>typeof c1.pp2 === "string" && c1.pp2 : string
|
||||
>typeof c1.pp2 === "string" : boolean
|
||||
>typeof c1.pp2 : string
|
||||
>typeof c1.pp2 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>c1.pp2 : string | number
|
||||
>c1 : C1
|
||||
>pp2 : string | number
|
||||
@ -94,7 +94,7 @@ strOrNum = typeof c1.pp3 === "string" && c1.pp3; // string | number
|
||||
>strOrNum : string | number
|
||||
>typeof c1.pp3 === "string" && c1.pp3 : string
|
||||
>typeof c1.pp3 === "string" : boolean
|
||||
>typeof c1.pp3 : string
|
||||
>typeof c1.pp3 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>c1.pp3 : string | number
|
||||
>c1 : C1
|
||||
>pp3 : string | number
|
||||
@ -115,7 +115,7 @@ strOrNum = typeof obj1.x === "string" && obj1.x; // string | number
|
||||
>strOrNum : string | number
|
||||
>typeof obj1.x === "string" && obj1.x : string
|
||||
>typeof obj1.x === "string" : boolean
|
||||
>typeof obj1.x : string
|
||||
>typeof obj1.x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>obj1.x : string | number
|
||||
>obj1 : { x: string | number; }
|
||||
>x : string | number
|
||||
|
||||
@ -8,7 +8,7 @@ function foo(x: number | string) {
|
||||
return typeof x === "string" && x.length === 10; // string
|
||||
>typeof x === "string" && x.length === 10 : boolean
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
>x.length === 10 : boolean
|
||||
@ -25,7 +25,7 @@ function foo2(x: number | string) {
|
||||
return typeof x === "string" && ((x = 10) && x); // string | number
|
||||
>typeof x === "string" && ((x = 10) && x) : number
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
>((x = 10) && x) : number
|
||||
@ -44,7 +44,7 @@ function foo3(x: number | string) {
|
||||
return typeof x === "string" && ((x = "hello") && x); // string | number
|
||||
>typeof x === "string" && ((x = "hello") && x) : string
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
>((x = "hello") && x) : string
|
||||
@ -63,13 +63,13 @@ function foo4(x: number | string | boolean) {
|
||||
>typeof x !== "string" // string | number | boolean && typeof x !== "number" // number | boolean && x : boolean
|
||||
>typeof x !== "string" // string | number | boolean && typeof x !== "number" : boolean
|
||||
>typeof x !== "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number | boolean
|
||||
>"string" : "string"
|
||||
|
||||
&& typeof x !== "number" // number | boolean
|
||||
>typeof x !== "number" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : number | boolean
|
||||
>"number" : "number"
|
||||
|
||||
@ -87,7 +87,7 @@ function foo5(x: number | string | boolean) {
|
||||
return typeof x !== "string" // string | number | boolean
|
||||
>typeof x !== "string" // string | number | boolean && ((b = x) && (typeof x !== "number" // number | boolean && x)) : boolean
|
||||
>typeof x !== "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number | boolean
|
||||
>"string" : "string"
|
||||
|
||||
@ -101,7 +101,7 @@ function foo5(x: number | string | boolean) {
|
||||
>(typeof x !== "number" // number | boolean && x) : boolean
|
||||
>typeof x !== "number" // number | boolean && x : boolean
|
||||
>typeof x !== "number" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : number | boolean
|
||||
>"number" : "number"
|
||||
|
||||
@ -116,7 +116,7 @@ function foo6(x: number | string | boolean) {
|
||||
return typeof x !== "string" // string | number | boolean
|
||||
>typeof x !== "string" // string | number | boolean && (typeof x !== "number" // number | boolean ? x // boolean : x === 10) : boolean
|
||||
>typeof x !== "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number | boolean
|
||||
>"string" : "string"
|
||||
|
||||
@ -124,7 +124,7 @@ function foo6(x: number | string | boolean) {
|
||||
>(typeof x !== "number" // number | boolean ? x // boolean : x === 10) : boolean
|
||||
>typeof x !== "number" // number | boolean ? x // boolean : x === 10 : boolean
|
||||
>typeof x !== "number" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : number | boolean
|
||||
>"number" : "number"
|
||||
|
||||
@ -150,7 +150,7 @@ function foo7(x: number | string | boolean) {
|
||||
return typeof x !== "string"
|
||||
>typeof x !== "string" && ((z = x) // number | boolean && (typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // x is number // do not change value : ((y = x) && x.toString()))) : string
|
||||
>typeof x !== "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number | boolean
|
||||
>"string" : "string"
|
||||
|
||||
@ -166,7 +166,7 @@ function foo7(x: number | string | boolean) {
|
||||
>(typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // x is number // do not change value : ((y = x) && x.toString())) : string
|
||||
>typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // x is number // do not change value : ((y = x) && x.toString()) : string
|
||||
>typeof x === "number" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : number | boolean
|
||||
>"number" : "number"
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ function foo(x: number | string) {
|
||||
return typeof x !== "string" || x.length === 10; // string
|
||||
>typeof x !== "string" || x.length === 10 : boolean
|
||||
>typeof x !== "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
>x.length === 10 : boolean
|
||||
@ -26,7 +26,7 @@ function foo2(x: number | string) {
|
||||
return typeof x !== "string" || ((x = 10) || x); // string | number
|
||||
>typeof x !== "string" || ((x = 10) || x) : number | true
|
||||
>typeof x !== "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
>((x = 10) || x) : number
|
||||
@ -45,7 +45,7 @@ function foo3(x: number | string) {
|
||||
return typeof x !== "string" || ((x = "hello") || x); // string | number
|
||||
>typeof x !== "string" || ((x = "hello") || x) : string | true
|
||||
>typeof x !== "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
>((x = "hello") || x) : string
|
||||
@ -64,13 +64,13 @@ function foo4(x: number | string | boolean) {
|
||||
>typeof x === "string" // string | number | boolean || typeof x === "number" // number | boolean || x : boolean
|
||||
>typeof x === "string" // string | number | boolean || typeof x === "number" : boolean
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number | boolean
|
||||
>"string" : "string"
|
||||
|
||||
|| typeof x === "number" // number | boolean
|
||||
>typeof x === "number" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : number | boolean
|
||||
>"number" : "number"
|
||||
|
||||
@ -88,7 +88,7 @@ function foo5(x: number | string | boolean) {
|
||||
return typeof x === "string" // string | number | boolean
|
||||
>typeof x === "string" // string | number | boolean || ((b = x) || (typeof x === "number" // number | boolean || x)) : number | boolean
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number | boolean
|
||||
>"string" : "string"
|
||||
|
||||
@ -102,7 +102,7 @@ function foo5(x: number | string | boolean) {
|
||||
>(typeof x === "number" // number | boolean || x) : boolean
|
||||
>typeof x === "number" // number | boolean || x : boolean
|
||||
>typeof x === "number" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : number | boolean
|
||||
>"number" : "number"
|
||||
|
||||
@ -117,7 +117,7 @@ function foo6(x: number | string | boolean) {
|
||||
return typeof x === "string" // string | number | boolean
|
||||
>typeof x === "string" // string | number | boolean || (typeof x !== "number" // number | boolean ? x // boolean : x === 10) : boolean
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number | boolean
|
||||
>"string" : "string"
|
||||
|
||||
@ -125,7 +125,7 @@ function foo6(x: number | string | boolean) {
|
||||
>(typeof x !== "number" // number | boolean ? x // boolean : x === 10) : boolean
|
||||
>typeof x !== "number" // number | boolean ? x // boolean : x === 10 : boolean
|
||||
>typeof x !== "number" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : number | boolean
|
||||
>"number" : "number"
|
||||
|
||||
@ -151,7 +151,7 @@ function foo7(x: number | string | boolean) {
|
||||
return typeof x === "string"
|
||||
>typeof x === "string" || ((z = x) // number | boolean || (typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // number | boolean | string // do not change value : ((y = x) && x.toString()))) : string | number | true
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number | boolean
|
||||
>"string" : "string"
|
||||
|
||||
@ -167,7 +167,7 @@ function foo7(x: number | string | boolean) {
|
||||
>(typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // number | boolean | string // do not change value : ((y = x) && x.toString())) : string
|
||||
>typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // number | boolean | string // do not change value : ((y = x) && x.toString()) : string
|
||||
>typeof x === "number" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : number | boolean
|
||||
>"number" : "number"
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ function a(x: string | number) {
|
||||
|
||||
while (typeof x === "string") {
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
|
||||
@ -29,7 +29,7 @@ function b(x: string | number) {
|
||||
|
||||
while (typeof x === "string") {
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
|
||||
@ -53,7 +53,7 @@ function c(x: string | number) {
|
||||
|
||||
while (typeof x === "string") {
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>x : string | number
|
||||
>"string" : "string"
|
||||
|
||||
|
||||
@ -103,7 +103,7 @@ function f4() {
|
||||
|
||||
if (typeof (x = getStringOrNumberOrNull()) === "number") {
|
||||
>typeof (x = getStringOrNumberOrNull()) === "number" : boolean
|
||||
>typeof (x = getStringOrNumberOrNull()) : string
|
||||
>typeof (x = getStringOrNumberOrNull()) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>(x = getStringOrNumberOrNull()) : string | number | null
|
||||
>x = getStringOrNumberOrNull() : string | number | null
|
||||
>x : string | number | null
|
||||
|
||||
@ -28,7 +28,7 @@ var obj1 = {
|
||||
>num : number
|
||||
>typeof var1 === "string" && var1.length : number
|
||||
>typeof var1 === "string" : boolean
|
||||
>typeof var1 : string
|
||||
>typeof var1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var1 : string | number
|
||||
>"string" : "string"
|
||||
>var1.length : number
|
||||
@ -44,7 +44,7 @@ var obj1 = {
|
||||
>num : number
|
||||
>typeof var2 === "string" && var2.length : number
|
||||
>typeof var2 === "string" : boolean
|
||||
>typeof var2 : string
|
||||
>typeof var2 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var2 : string | number
|
||||
>"string" : "string"
|
||||
>var2.length : number
|
||||
@ -57,7 +57,7 @@ var obj1 = {
|
||||
>num : number
|
||||
>typeof param === "string" && param.length : number
|
||||
>typeof param === "string" : boolean
|
||||
>typeof param : string
|
||||
>typeof param : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>param : string | number
|
||||
>"string" : "string"
|
||||
>param.length : number
|
||||
@ -77,7 +77,7 @@ var obj1 = {
|
||||
>num : number
|
||||
>typeof var1 === "string" && var1.length : number
|
||||
>typeof var1 === "string" : boolean
|
||||
>typeof var1 : string
|
||||
>typeof var1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var1 : string | number
|
||||
>"string" : "string"
|
||||
>var1.length : number
|
||||
@ -93,7 +93,7 @@ var obj1 = {
|
||||
>num : number
|
||||
>typeof var2 === "string" && var2.length : number
|
||||
>typeof var2 === "string" : boolean
|
||||
>typeof var2 : string
|
||||
>typeof var2 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var2 : string | number
|
||||
>"string" : "string"
|
||||
>var2.length : number
|
||||
@ -114,7 +114,7 @@ var obj1 = {
|
||||
>num : number
|
||||
>typeof var1 === "string" && var1.length : number
|
||||
>typeof var1 === "string" : boolean
|
||||
>typeof var1 : string
|
||||
>typeof var1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var1 : string | number
|
||||
>"string" : "string"
|
||||
>var1.length : number
|
||||
@ -130,7 +130,7 @@ var obj1 = {
|
||||
>num : number
|
||||
>typeof var2 === "string" && var2.length : number
|
||||
>typeof var2 === "string" : boolean
|
||||
>typeof var2 : string
|
||||
>typeof var2 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>var2 : string | number
|
||||
>"string" : "string"
|
||||
>var2.length : number
|
||||
@ -143,7 +143,7 @@ var obj1 = {
|
||||
>num : number
|
||||
>typeof param === "string" && param.length : number
|
||||
>typeof param === "string" : boolean
|
||||
>typeof param : string
|
||||
>typeof param : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>param : string | number
|
||||
>"string" : "string"
|
||||
>param.length : number
|
||||
@ -157,7 +157,7 @@ strOrNum = typeof obj1.method(strOrNum) === "string" && obj1.method(strOrNum);
|
||||
>strOrNum : string | number
|
||||
>typeof obj1.method(strOrNum) === "string" && obj1.method(strOrNum) : string | number
|
||||
>typeof obj1.method(strOrNum) === "string" : boolean
|
||||
>typeof obj1.method(strOrNum) : string
|
||||
>typeof obj1.method(strOrNum) : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>obj1.method(strOrNum) : string | number
|
||||
>obj1.method : (param: string | number) => string | number
|
||||
>obj1 : { method(param: string | number): string | number; prop: string | number; }
|
||||
@ -176,7 +176,7 @@ strOrNum = typeof obj1.prop === "string" && obj1.prop;
|
||||
>strOrNum : string | number
|
||||
>typeof obj1.prop === "string" && obj1.prop : string
|
||||
>typeof obj1.prop === "string" : boolean
|
||||
>typeof obj1.prop : string
|
||||
>typeof obj1.prop : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>obj1.prop : string | number
|
||||
>obj1 : { method(param: string | number): string | number; prop: string | number; }
|
||||
>prop : string | number
|
||||
|
||||
@ -22,7 +22,7 @@ class D {
|
||||
return typeof data === "string" ? data : data.join(" ");
|
||||
>typeof data === "string" ? data : data.join(" ") : string
|
||||
>typeof data === "string" : boolean
|
||||
>typeof data : string
|
||||
>typeof data : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>data : string | string[]
|
||||
>"string" : "string"
|
||||
>data : string
|
||||
@ -39,7 +39,7 @@ class D {
|
||||
return typeof this.data === "string" ? this.data : this.data.join(" ");
|
||||
>typeof this.data === "string" ? this.data : this.data.join(" ") : string
|
||||
>typeof this.data === "string" : boolean
|
||||
>typeof this.data : string
|
||||
>typeof this.data : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>this.data : string | string[]
|
||||
>this : this
|
||||
>data : string | string[]
|
||||
@ -81,7 +81,7 @@ var o: {
|
||||
if (typeof o.prop1 === "string" && o.prop1.toLowerCase()) {}
|
||||
>typeof o.prop1 === "string" && o.prop1.toLowerCase() : string
|
||||
>typeof o.prop1 === "string" : boolean
|
||||
>typeof o.prop1 : string
|
||||
>typeof o.prop1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>o.prop1 : string | number
|
||||
>o : { prop1: string | number; prop2: string | boolean; }
|
||||
>prop1 : string | number
|
||||
@ -102,7 +102,7 @@ var prop1 = o.prop1;
|
||||
if (typeof prop1 === "string" && prop1.toLocaleLowerCase()) { }
|
||||
>typeof prop1 === "string" && prop1.toLocaleLowerCase() : string
|
||||
>typeof prop1 === "string" : boolean
|
||||
>typeof prop1 : string
|
||||
>typeof prop1 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>prop1 : string | number
|
||||
>"string" : "string"
|
||||
>prop1.toLocaleLowerCase() : string
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
tests/cases/compiler/typeOfOperator1.ts(3,5): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/typeOfOperator1.ts(3,5): error TS2322: Type '"string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"' is not assignable to type 'number'.
|
||||
Type '"string"' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/typeOfOperator1.ts (1 errors) ====
|
||||
@ -6,4 +7,5 @@ tests/cases/compiler/typeOfOperator1.ts(3,5): error TS2322: Type 'string' is not
|
||||
var y: string = typeof x;
|
||||
var z: number = typeof x;
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type '"string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type '"string"' is not assignable to type 'number'.
|
||||
@ -36,6 +36,12 @@ if (typeof boolOrC === "Object") {
|
||||
else {
|
||||
var r4: boolean = boolOrC; // boolean
|
||||
}
|
||||
if (typeof strOrC === "Object" as string) { // comparison is OK with cast
|
||||
c = strOrC; // error: but no narrowing to C
|
||||
}
|
||||
else {
|
||||
var r5: string = strOrC; // error: no narrowing to string
|
||||
}
|
||||
|
||||
if (typeof strOrNumOrBool === "Object") {
|
||||
let q1: {} = strOrNumOrBool; // {}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user