swc/crates/swc_ecma_parser/tests/tsc/exponentiationOperatorWithEnumUnion.ts

28 lines
406 B
TypeScript
Raw Normal View History

// operands of an enum type are treated as having the primitive type Number.
enum E {
a,
b
}
enum F {
c,
d
}
var a: any;
var b: number;
var c: E | F;
// operator **
var r1 = c ** a;
var r2 = c ** b;
var r3 = c ** c;
var r4 = a ** c;
var r5 = b ** c;
var r6 = E.a ** a;
var r7 = E.a ** b;
var r8 = E.a ** E.b;
var r9 = E.a ** 1;
var r10 = a ** E.b;
var r11 = b ** E.b;
var r12 = 1 ** E.b;