mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
//// [tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndValidOperands.ts] ////
|
|
|
|
//// [exponentiationOperatorWithNullValueAndValidOperands.ts]
|
|
// If one operand is the null or undefined value, it is treated as having the type of the
|
|
// other operand.
|
|
|
|
enum E {
|
|
a,
|
|
b
|
|
}
|
|
|
|
declare var a: any;
|
|
declare var b: number;
|
|
|
|
// operator **
|
|
var r1 = null ** a;
|
|
var r2 = null ** b;
|
|
var r3 = null ** 1;
|
|
var r4 = null ** E.a;
|
|
var r5 = a ** null;
|
|
var r6 = b ** null;
|
|
var r7 = 0 ** null;
|
|
var r8 = E.b ** null;
|
|
|
|
//// [exponentiationOperatorWithNullValueAndValidOperands.js]
|
|
"use strict";
|
|
// If one operand is the null or undefined value, it is treated as having the type of the
|
|
// other operand.
|
|
var E;
|
|
(function (E) {
|
|
E[E["a"] = 0] = "a";
|
|
E[E["b"] = 1] = "b";
|
|
})(E || (E = {}));
|
|
// operator **
|
|
var r1 = Math.pow(null, a);
|
|
var r2 = Math.pow(null, b);
|
|
var r3 = Math.pow(null, 1);
|
|
var r4 = Math.pow(null, E.a);
|
|
var r5 = Math.pow(a, null);
|
|
var r6 = Math.pow(b, null);
|
|
var r7 = Math.pow(0, null);
|
|
var r8 = Math.pow(E.b, null);
|