92 lines
2 KiB
Plaintext
92 lines
2 KiB
Plaintext
=== tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithEnumType.ts ===
|
|
// typeof operator on enum type
|
|
|
|
enum ENUM { };
|
|
>ENUM : ENUM
|
|
|
|
enum ENUM1 { A, B, "" };
|
|
>ENUM1 : ENUM1
|
|
>A : ENUM1
|
|
>B : ENUM1
|
|
|
|
// enum type var
|
|
var ResultIsString1 = typeof ENUM;
|
|
>ResultIsString1 : string
|
|
>typeof ENUM : string
|
|
>ENUM : typeof ENUM
|
|
|
|
var ResultIsString2 = typeof ENUM1;
|
|
>ResultIsString2 : string
|
|
>typeof ENUM1 : string
|
|
>ENUM1 : typeof ENUM1
|
|
|
|
// enum type expressions
|
|
var ResultIsString3 = typeof ENUM1["A"];
|
|
>ResultIsString3 : string
|
|
>typeof ENUM1["A"] : string
|
|
>ENUM1["A"] : ENUM1
|
|
>ENUM1 : typeof ENUM1
|
|
|
|
var ResultIsString4 = typeof (ENUM[0] + ENUM1["B"]);
|
|
>ResultIsString4 : string
|
|
>typeof (ENUM[0] + ENUM1["B"]) : string
|
|
>(ENUM[0] + ENUM1["B"]) : string
|
|
>ENUM[0] + ENUM1["B"] : string
|
|
>ENUM[0] : string
|
|
>ENUM : typeof ENUM
|
|
>ENUM1["B"] : ENUM1
|
|
>ENUM1 : typeof ENUM1
|
|
|
|
// multiple typeof operators
|
|
var ResultIsString5 = typeof typeof ENUM;
|
|
>ResultIsString5 : string
|
|
>typeof typeof ENUM : string
|
|
>typeof ENUM : string
|
|
>ENUM : typeof ENUM
|
|
|
|
var ResultIsString6 = typeof typeof typeof (ENUM[0] + ENUM1.B);
|
|
>ResultIsString6 : string
|
|
>typeof typeof typeof (ENUM[0] + ENUM1.B) : string
|
|
>typeof typeof (ENUM[0] + ENUM1.B) : string
|
|
>typeof (ENUM[0] + ENUM1.B) : string
|
|
>(ENUM[0] + ENUM1.B) : string
|
|
>ENUM[0] + ENUM1.B : string
|
|
>ENUM[0] : string
|
|
>ENUM : typeof ENUM
|
|
>ENUM1.B : ENUM1
|
|
>ENUM1 : typeof ENUM1
|
|
>B : ENUM1
|
|
|
|
// miss assignment operators
|
|
typeof ENUM;
|
|
>typeof ENUM : string
|
|
>ENUM : typeof ENUM
|
|
|
|
typeof ENUM1;
|
|
>typeof ENUM1 : string
|
|
>ENUM1 : typeof ENUM1
|
|
|
|
typeof ENUM1["B"];
|
|
>typeof ENUM1["B"] : string
|
|
>ENUM1["B"] : ENUM1
|
|
>ENUM1 : typeof ENUM1
|
|
|
|
typeof ENUM, ENUM1;
|
|
>typeof ENUM, ENUM1 : typeof ENUM1
|
|
>typeof ENUM : string
|
|
>ENUM : typeof ENUM
|
|
>ENUM1 : typeof ENUM1
|
|
|
|
// use typeof in type query
|
|
enum z { };
|
|
>z : z
|
|
|
|
z: typeof ENUM;
|
|
>typeof ENUM : string
|
|
>ENUM : typeof ENUM
|
|
|
|
z: typeof ENUM1;
|
|
>typeof ENUM1 : string
|
|
>ENUM1 : typeof ENUM1
|
|
|