169 lines
7 KiB
Plaintext
169 lines
7 KiB
Plaintext
=== tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithNumberType.ts ===
|
|
// typeof operator on number type
|
|
var NUMBER: number;
|
|
>NUMBER : Symbol(NUMBER, Decl(typeofOperatorWithNumberType.ts, 1, 3))
|
|
|
|
var NUMBER1: number[] = [1, 2];
|
|
>NUMBER1 : Symbol(NUMBER1, Decl(typeofOperatorWithNumberType.ts, 2, 3))
|
|
|
|
function foo(): number { return 1; }
|
|
>foo : Symbol(foo, Decl(typeofOperatorWithNumberType.ts, 2, 31))
|
|
|
|
class A {
|
|
>A : Symbol(A, Decl(typeofOperatorWithNumberType.ts, 4, 36))
|
|
|
|
public a: number;
|
|
>a : Symbol(a, Decl(typeofOperatorWithNumberType.ts, 6, 9))
|
|
|
|
static foo() { return 1; }
|
|
>foo : Symbol(A.foo, Decl(typeofOperatorWithNumberType.ts, 7, 21))
|
|
}
|
|
module M {
|
|
>M : Symbol(M, Decl(typeofOperatorWithNumberType.ts, 9, 1))
|
|
|
|
export var n: number;
|
|
>n : Symbol(n, Decl(typeofOperatorWithNumberType.ts, 11, 14))
|
|
}
|
|
|
|
var objA = new A();
|
|
>objA : Symbol(objA, Decl(typeofOperatorWithNumberType.ts, 14, 3))
|
|
>A : Symbol(A, Decl(typeofOperatorWithNumberType.ts, 4, 36))
|
|
|
|
// number type var
|
|
var ResultIsString1 = typeof NUMBER;
|
|
>ResultIsString1 : Symbol(ResultIsString1, Decl(typeofOperatorWithNumberType.ts, 17, 3))
|
|
>NUMBER : Symbol(NUMBER, Decl(typeofOperatorWithNumberType.ts, 1, 3))
|
|
|
|
var ResultIsString2 = typeof NUMBER1;
|
|
>ResultIsString2 : Symbol(ResultIsString2, Decl(typeofOperatorWithNumberType.ts, 18, 3))
|
|
>NUMBER1 : Symbol(NUMBER1, Decl(typeofOperatorWithNumberType.ts, 2, 3))
|
|
|
|
// number type literal
|
|
var ResultIsString3 = typeof 1;
|
|
>ResultIsString3 : Symbol(ResultIsString3, Decl(typeofOperatorWithNumberType.ts, 21, 3))
|
|
|
|
var ResultIsString4 = typeof { x: 1, y: 2};
|
|
>ResultIsString4 : Symbol(ResultIsString4, Decl(typeofOperatorWithNumberType.ts, 22, 3))
|
|
>x : Symbol(x, Decl(typeofOperatorWithNumberType.ts, 22, 30))
|
|
>y : Symbol(y, Decl(typeofOperatorWithNumberType.ts, 22, 36))
|
|
|
|
var ResultIsString5 = typeof { x: 1, y: (n: number) => { return n; } };
|
|
>ResultIsString5 : Symbol(ResultIsString5, Decl(typeofOperatorWithNumberType.ts, 23, 3))
|
|
>x : Symbol(x, Decl(typeofOperatorWithNumberType.ts, 23, 30))
|
|
>y : Symbol(y, Decl(typeofOperatorWithNumberType.ts, 23, 36))
|
|
>n : Symbol(n, Decl(typeofOperatorWithNumberType.ts, 23, 41))
|
|
>n : Symbol(n, Decl(typeofOperatorWithNumberType.ts, 23, 41))
|
|
|
|
// number type expressions
|
|
var ResultIsString6 = typeof objA.a;
|
|
>ResultIsString6 : Symbol(ResultIsString6, Decl(typeofOperatorWithNumberType.ts, 26, 3))
|
|
>objA.a : Symbol(A.a, Decl(typeofOperatorWithNumberType.ts, 6, 9))
|
|
>objA : Symbol(objA, Decl(typeofOperatorWithNumberType.ts, 14, 3))
|
|
>a : Symbol(A.a, Decl(typeofOperatorWithNumberType.ts, 6, 9))
|
|
|
|
var ResultIsString7 = typeof M.n;
|
|
>ResultIsString7 : Symbol(ResultIsString7, Decl(typeofOperatorWithNumberType.ts, 27, 3))
|
|
>M.n : Symbol(M.n, Decl(typeofOperatorWithNumberType.ts, 11, 14))
|
|
>M : Symbol(M, Decl(typeofOperatorWithNumberType.ts, 9, 1))
|
|
>n : Symbol(M.n, Decl(typeofOperatorWithNumberType.ts, 11, 14))
|
|
|
|
var ResultIsString8 = typeof NUMBER1[0];
|
|
>ResultIsString8 : Symbol(ResultIsString8, Decl(typeofOperatorWithNumberType.ts, 28, 3))
|
|
>NUMBER1 : Symbol(NUMBER1, Decl(typeofOperatorWithNumberType.ts, 2, 3))
|
|
|
|
var ResultIsString9 = typeof foo();
|
|
>ResultIsString9 : Symbol(ResultIsString9, Decl(typeofOperatorWithNumberType.ts, 29, 3))
|
|
>foo : Symbol(foo, Decl(typeofOperatorWithNumberType.ts, 2, 31))
|
|
|
|
var ResultIsString10 = typeof A.foo();
|
|
>ResultIsString10 : Symbol(ResultIsString10, Decl(typeofOperatorWithNumberType.ts, 30, 3))
|
|
>A.foo : Symbol(A.foo, Decl(typeofOperatorWithNumberType.ts, 7, 21))
|
|
>A : Symbol(A, Decl(typeofOperatorWithNumberType.ts, 4, 36))
|
|
>foo : Symbol(A.foo, Decl(typeofOperatorWithNumberType.ts, 7, 21))
|
|
|
|
var ResultIsString11 = typeof (NUMBER + NUMBER);
|
|
>ResultIsString11 : Symbol(ResultIsString11, Decl(typeofOperatorWithNumberType.ts, 31, 3))
|
|
>NUMBER : Symbol(NUMBER, Decl(typeofOperatorWithNumberType.ts, 1, 3))
|
|
>NUMBER : Symbol(NUMBER, Decl(typeofOperatorWithNumberType.ts, 1, 3))
|
|
|
|
// multiple typeof operators
|
|
var ResultIsString12 = typeof typeof NUMBER;
|
|
>ResultIsString12 : Symbol(ResultIsString12, Decl(typeofOperatorWithNumberType.ts, 34, 3))
|
|
>NUMBER : Symbol(NUMBER, Decl(typeofOperatorWithNumberType.ts, 1, 3))
|
|
|
|
var ResultIsString13 = typeof typeof typeof (NUMBER + NUMBER);
|
|
>ResultIsString13 : Symbol(ResultIsString13, Decl(typeofOperatorWithNumberType.ts, 35, 3))
|
|
>NUMBER : Symbol(NUMBER, Decl(typeofOperatorWithNumberType.ts, 1, 3))
|
|
>NUMBER : Symbol(NUMBER, Decl(typeofOperatorWithNumberType.ts, 1, 3))
|
|
|
|
// miss assignment operators
|
|
typeof 1;
|
|
typeof NUMBER;
|
|
>NUMBER : Symbol(NUMBER, Decl(typeofOperatorWithNumberType.ts, 1, 3))
|
|
|
|
typeof NUMBER1;
|
|
>NUMBER1 : Symbol(NUMBER1, Decl(typeofOperatorWithNumberType.ts, 2, 3))
|
|
|
|
typeof foo();
|
|
>foo : Symbol(foo, Decl(typeofOperatorWithNumberType.ts, 2, 31))
|
|
|
|
typeof objA.a;
|
|
>objA.a : Symbol(A.a, Decl(typeofOperatorWithNumberType.ts, 6, 9))
|
|
>objA : Symbol(objA, Decl(typeofOperatorWithNumberType.ts, 14, 3))
|
|
>a : Symbol(A.a, Decl(typeofOperatorWithNumberType.ts, 6, 9))
|
|
|
|
typeof M.n;
|
|
>M.n : Symbol(M.n, Decl(typeofOperatorWithNumberType.ts, 11, 14))
|
|
>M : Symbol(M, Decl(typeofOperatorWithNumberType.ts, 9, 1))
|
|
>n : Symbol(M.n, Decl(typeofOperatorWithNumberType.ts, 11, 14))
|
|
|
|
typeof objA.a, M.n;
|
|
>objA.a : Symbol(A.a, Decl(typeofOperatorWithNumberType.ts, 6, 9))
|
|
>objA : Symbol(objA, Decl(typeofOperatorWithNumberType.ts, 14, 3))
|
|
>a : Symbol(A.a, Decl(typeofOperatorWithNumberType.ts, 6, 9))
|
|
>M.n : Symbol(M.n, Decl(typeofOperatorWithNumberType.ts, 11, 14))
|
|
>M : Symbol(M, Decl(typeofOperatorWithNumberType.ts, 9, 1))
|
|
>n : Symbol(M.n, Decl(typeofOperatorWithNumberType.ts, 11, 14))
|
|
|
|
// use typeof in type query
|
|
var z: number;
|
|
>z : Symbol(z, Decl(typeofOperatorWithNumberType.ts, 47, 3))
|
|
|
|
var x: number[];
|
|
>x : Symbol(x, Decl(typeofOperatorWithNumberType.ts, 48, 3))
|
|
|
|
z: typeof NUMBER;
|
|
>NUMBER : Symbol(NUMBER, Decl(typeofOperatorWithNumberType.ts, 1, 3))
|
|
|
|
x: typeof NUMBER1;
|
|
>NUMBER1 : Symbol(NUMBER1, Decl(typeofOperatorWithNumberType.ts, 2, 3))
|
|
|
|
r: typeof foo;
|
|
>foo : Symbol(foo, Decl(typeofOperatorWithNumberType.ts, 2, 31))
|
|
|
|
var y = { a: 1, b: 2 };
|
|
>y : Symbol(y, Decl(typeofOperatorWithNumberType.ts, 52, 3))
|
|
>a : Symbol(a, Decl(typeofOperatorWithNumberType.ts, 52, 9))
|
|
>b : Symbol(b, Decl(typeofOperatorWithNumberType.ts, 52, 15))
|
|
|
|
z: typeof y.a;
|
|
>y.a : Symbol(a, Decl(typeofOperatorWithNumberType.ts, 52, 9))
|
|
>y : Symbol(y, Decl(typeofOperatorWithNumberType.ts, 52, 3))
|
|
>a : Symbol(a, Decl(typeofOperatorWithNumberType.ts, 52, 9))
|
|
|
|
z: typeof objA.a;
|
|
>objA.a : Symbol(A.a, Decl(typeofOperatorWithNumberType.ts, 6, 9))
|
|
>objA : Symbol(objA, Decl(typeofOperatorWithNumberType.ts, 14, 3))
|
|
>a : Symbol(A.a, Decl(typeofOperatorWithNumberType.ts, 6, 9))
|
|
|
|
z: typeof A.foo;
|
|
>A.foo : Symbol(A.foo, Decl(typeofOperatorWithNumberType.ts, 7, 21))
|
|
>A : Symbol(A, Decl(typeofOperatorWithNumberType.ts, 4, 36))
|
|
>foo : Symbol(A.foo, Decl(typeofOperatorWithNumberType.ts, 7, 21))
|
|
|
|
z: typeof M.n;
|
|
>M.n : Symbol(M.n, Decl(typeofOperatorWithNumberType.ts, 11, 14))
|
|
>M : Symbol(M, Decl(typeofOperatorWithNumberType.ts, 9, 1))
|
|
>n : Symbol(M.n, Decl(typeofOperatorWithNumberType.ts, 11, 14))
|
|
|