1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
|
=== tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithBooleanType.ts ===
// typeof operator on boolean type
var BOOLEAN: boolean;
>BOOLEAN : Symbol(BOOLEAN, Decl(typeofOperatorWithBooleanType.ts, 2, 3))
function foo(): boolean { return true; }
>foo : Symbol(foo, Decl(typeofOperatorWithBooleanType.ts, 2, 21))
class A {
>A : Symbol(A, Decl(typeofOperatorWithBooleanType.ts, 4, 40))
public a: boolean;
>a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 6, 9))
static foo() { return false; }
>foo : Symbol(A.foo, Decl(typeofOperatorWithBooleanType.ts, 7, 22))
}
module M {
>M : Symbol(M, Decl(typeofOperatorWithBooleanType.ts, 9, 1))
export var n: boolean;
>n : Symbol(n, Decl(typeofOperatorWithBooleanType.ts, 11, 14))
}
var objA = new A();
>objA : Symbol(objA, Decl(typeofOperatorWithBooleanType.ts, 14, 3))
>A : Symbol(A, Decl(typeofOperatorWithBooleanType.ts, 4, 40))
// boolean type var
var ResultIsString1 = typeof BOOLEAN;
>ResultIsString1 : Symbol(ResultIsString1, Decl(typeofOperatorWithBooleanType.ts, 17, 3))
>BOOLEAN : Symbol(BOOLEAN, Decl(typeofOperatorWithBooleanType.ts, 2, 3))
// boolean type literal
var ResultIsString2 = typeof true;
>ResultIsString2 : Symbol(ResultIsString2, Decl(typeofOperatorWithBooleanType.ts, 20, 3))
var ResultIsString3 = typeof { x: true, y: false };
>ResultIsString3 : Symbol(ResultIsString3, Decl(typeofOperatorWithBooleanType.ts, 21, 3))
>x : Symbol(x, Decl(typeofOperatorWithBooleanType.ts, 21, 30))
>y : Symbol(y, Decl(typeofOperatorWithBooleanType.ts, 21, 39))
// boolean type expressions
var ResultIsString4 = typeof objA.a;
>ResultIsString4 : Symbol(ResultIsString4, Decl(typeofOperatorWithBooleanType.ts, 24, 3))
>objA.a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 6, 9))
>objA : Symbol(objA, Decl(typeofOperatorWithBooleanType.ts, 14, 3))
>a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 6, 9))
var ResultIsString5 = typeof M.n;
>ResultIsString5 : Symbol(ResultIsString5, Decl(typeofOperatorWithBooleanType.ts, 25, 3))
>M.n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 11, 14))
>M : Symbol(M, Decl(typeofOperatorWithBooleanType.ts, 9, 1))
>n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 11, 14))
var ResultIsString6 = typeof foo();
>ResultIsString6 : Symbol(ResultIsString6, Decl(typeofOperatorWithBooleanType.ts, 26, 3))
>foo : Symbol(foo, Decl(typeofOperatorWithBooleanType.ts, 2, 21))
var ResultIsString7 = typeof A.foo();
>ResultIsString7 : Symbol(ResultIsString7, Decl(typeofOperatorWithBooleanType.ts, 27, 3))
>A.foo : Symbol(A.foo, Decl(typeofOperatorWithBooleanType.ts, 7, 22))
>A : Symbol(A, Decl(typeofOperatorWithBooleanType.ts, 4, 40))
>foo : Symbol(A.foo, Decl(typeofOperatorWithBooleanType.ts, 7, 22))
// multiple typeof operator
var ResultIsString8 = typeof typeof BOOLEAN;
>ResultIsString8 : Symbol(ResultIsString8, Decl(typeofOperatorWithBooleanType.ts, 30, 3))
>BOOLEAN : Symbol(BOOLEAN, Decl(typeofOperatorWithBooleanType.ts, 2, 3))
// miss assignment operators
typeof true;
typeof BOOLEAN;
>BOOLEAN : Symbol(BOOLEAN, Decl(typeofOperatorWithBooleanType.ts, 2, 3))
typeof foo();
>foo : Symbol(foo, Decl(typeofOperatorWithBooleanType.ts, 2, 21))
typeof true, false;
typeof objA.a;
>objA.a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 6, 9))
>objA : Symbol(objA, Decl(typeofOperatorWithBooleanType.ts, 14, 3))
>a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 6, 9))
typeof M.n;
>M.n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 11, 14))
>M : Symbol(M, Decl(typeofOperatorWithBooleanType.ts, 9, 1))
>n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 11, 14))
// use typeof in type query
var z: boolean;
>z : Symbol(z, Decl(typeofOperatorWithBooleanType.ts, 41, 3))
var x: boolean[];
>x : Symbol(x, Decl(typeofOperatorWithBooleanType.ts, 42, 3))
var r: () => boolean;
>r : Symbol(r, Decl(typeofOperatorWithBooleanType.ts, 43, 3))
z: typeof BOOLEAN;
>BOOLEAN : Symbol(BOOLEAN, Decl(typeofOperatorWithBooleanType.ts, 2, 3))
r: typeof foo;
>foo : Symbol(foo, Decl(typeofOperatorWithBooleanType.ts, 2, 21))
var y = { a: true, b: false};
>y : Symbol(y, Decl(typeofOperatorWithBooleanType.ts, 46, 3))
>a : Symbol(a, Decl(typeofOperatorWithBooleanType.ts, 46, 9))
>b : Symbol(b, Decl(typeofOperatorWithBooleanType.ts, 46, 18))
z: typeof y.a;
>y.a : Symbol(a, Decl(typeofOperatorWithBooleanType.ts, 46, 9))
>y : Symbol(y, Decl(typeofOperatorWithBooleanType.ts, 46, 3))
>a : Symbol(a, Decl(typeofOperatorWithBooleanType.ts, 46, 9))
z: typeof objA.a;
>objA.a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 6, 9))
>objA : Symbol(objA, Decl(typeofOperatorWithBooleanType.ts, 14, 3))
>a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 6, 9))
z: typeof A.foo;
>A.foo : Symbol(A.foo, Decl(typeofOperatorWithBooleanType.ts, 7, 22))
>A : Symbol(A, Decl(typeofOperatorWithBooleanType.ts, 4, 40))
>foo : Symbol(A.foo, Decl(typeofOperatorWithBooleanType.ts, 7, 22))
z: typeof M.n;
>M.n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 11, 14))
>M : Symbol(M, Decl(typeofOperatorWithBooleanType.ts, 9, 1))
>n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 11, 14))
|