TypeScript/tests/baselines/reference/typeofOperatorWithEnumType.types

99 lines
2.1 KiB
Plaintext
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithEnumType.ts ===
// typeof operator on enum type
enum ENUM { };
>ENUM : ENUM
2014-08-15 23:33:16 +02:00
enum ENUM1 { A, B, "" };
>ENUM1 : ENUM1
>A : ENUM1
>B : ENUM1
2014-08-15 23:33:16 +02:00
// enum type var
var ResultIsString1 = typeof ENUM;
>ResultIsString1 : string
2014-08-15 23:33:16 +02:00
>typeof ENUM : string
>ENUM : typeof ENUM
2014-08-15 23:33:16 +02:00
var ResultIsString2 = typeof ENUM1;
>ResultIsString2 : string
2014-08-15 23:33:16 +02:00
>typeof ENUM1 : string
>ENUM1 : typeof ENUM1
2014-08-15 23:33:16 +02:00
// enum type expressions
2014-10-08 20:11:36 +02:00
var ResultIsString3 = typeof ENUM1["A"];
>ResultIsString3 : string
2014-10-08 20:11:36 +02:00
>typeof ENUM1["A"] : string
>ENUM1["A"] : ENUM1
>ENUM1 : typeof ENUM1
>"A" : string
2014-08-15 23:33:16 +02:00
2014-10-08 20:11:36 +02:00
var ResultIsString4 = typeof (ENUM[0] + ENUM1["B"]);
>ResultIsString4 : string
2014-10-08 20:11:36 +02:00
>typeof (ENUM[0] + ENUM1["B"]) : string
>(ENUM[0] + ENUM1["B"]) : string
>ENUM[0] + ENUM1["B"] : string
2014-08-15 23:33:16 +02:00
>ENUM[0] : string
>ENUM : typeof ENUM
2015-04-13 21:36:11 +02:00
>0 : number
2014-10-08 20:11:36 +02:00
>ENUM1["B"] : ENUM1
>ENUM1 : typeof ENUM1
>"B" : string
2014-08-15 23:33:16 +02:00
// multiple typeof operators
var ResultIsString5 = typeof typeof ENUM;
>ResultIsString5 : string
2014-08-15 23:33:16 +02:00
>typeof typeof ENUM : string
>typeof ENUM : string
>ENUM : typeof ENUM
2014-08-15 23:33:16 +02:00
2014-10-08 20:11:36 +02:00
var ResultIsString6 = typeof typeof typeof (ENUM[0] + ENUM1.B);
>ResultIsString6 : string
2014-10-08 20:11:36 +02:00
>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
2014-08-15 23:33:16 +02:00
>ENUM[0] : string
>ENUM : typeof ENUM
2015-04-13 21:36:11 +02:00
>0 : number
>ENUM1.B : ENUM1
>ENUM1 : typeof ENUM1
>B : ENUM1
2014-08-15 23:33:16 +02:00
// miss assignment operators
typeof ENUM;
>typeof ENUM : string
>ENUM : typeof ENUM
2014-08-15 23:33:16 +02:00
typeof ENUM1;
>typeof ENUM1 : string
>ENUM1 : typeof ENUM1
2014-08-15 23:33:16 +02:00
2014-10-08 20:11:36 +02:00
typeof ENUM1["B"];
>typeof ENUM1["B"] : string
>ENUM1["B"] : ENUM1
>ENUM1 : typeof ENUM1
>"B" : string
2014-08-15 23:33:16 +02:00
typeof ENUM, ENUM1;
>typeof ENUM, ENUM1 : typeof ENUM1
>typeof ENUM : string
>ENUM : typeof ENUM
>ENUM1 : typeof ENUM1
2014-08-15 23:33:16 +02:00
// use typeof in type query
enum z { };
>z : z
2014-08-15 23:33:16 +02:00
z: typeof ENUM;
>z : any
2014-08-15 23:33:16 +02:00
>typeof ENUM : string
>ENUM : typeof ENUM
2014-08-15 23:33:16 +02:00
z: typeof ENUM1;
>z : any
2014-08-15 23:33:16 +02:00
>typeof ENUM1 : string
>ENUM1 : typeof ENUM1
2014-08-15 23:33:16 +02:00