2014-07-13 01:04:16 +02:00
|
|
|
//// [voidOperatorWithNumberType.ts]
|
|
|
|
// void operator on number type
|
|
|
|
var NUMBER: number;
|
|
|
|
var NUMBER1: number[] = [1, 2];
|
|
|
|
|
|
|
|
function foo(): number { return 1; }
|
|
|
|
|
|
|
|
class A {
|
|
|
|
public a: number;
|
|
|
|
static foo() { return 1; }
|
|
|
|
}
|
|
|
|
module M {
|
|
|
|
export var n: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
var objA = new A();
|
|
|
|
|
|
|
|
// number type var
|
|
|
|
var ResultIsAny1 = void NUMBER;
|
|
|
|
var ResultIsAny2 = void NUMBER1;
|
|
|
|
|
|
|
|
// number type literal
|
|
|
|
var ResultIsAny3 = void 1;
|
|
|
|
var ResultIsAny4 = void { x: 1, y: 2};
|
|
|
|
var ResultIsAny5 = void { x: 1, y: (n: number) => { return n; } };
|
|
|
|
|
|
|
|
// number type expressions
|
|
|
|
var ResultIsAny6 = void objA.a;
|
|
|
|
var ResultIsAny7 = void M.n;
|
|
|
|
var ResultIsAny8 = void NUMBER1[0];
|
|
|
|
var ResultIsAny9 = void foo();
|
|
|
|
var ResultIsAny10 = void A.foo();
|
|
|
|
var ResultIsAny11 = void (NUMBER + NUMBER);
|
|
|
|
|
|
|
|
// multiple void operators
|
|
|
|
var ResultIsAny12 = void void NUMBER;
|
|
|
|
var ResultIsAny13 = void void void (NUMBER + NUMBER);
|
|
|
|
|
|
|
|
// miss assignment operators
|
|
|
|
void 1;
|
|
|
|
void NUMBER;
|
|
|
|
void NUMBER1;
|
|
|
|
void foo();
|
|
|
|
void objA.a;
|
|
|
|
void M.n;
|
|
|
|
void objA.a, M.n;
|
|
|
|
|
|
|
|
//// [voidOperatorWithNumberType.js]
|
2014-08-12 00:54:12 +02:00
|
|
|
// void operator on number type
|
2014-07-13 01:04:16 +02:00
|
|
|
var NUMBER;
|
|
|
|
var NUMBER1 = [1, 2];
|
2015-02-07 05:03:24 +01:00
|
|
|
function foo() { return 1; }
|
2014-07-13 01:04:16 +02:00
|
|
|
var A = (function () {
|
|
|
|
function A() {
|
|
|
|
}
|
2015-02-07 05:03:24 +01:00
|
|
|
A.foo = function () { return 1; };
|
2014-07-13 01:04:16 +02:00
|
|
|
return A;
|
|
|
|
})();
|
|
|
|
var M;
|
|
|
|
(function (M) {
|
|
|
|
M.n;
|
|
|
|
})(M || (M = {}));
|
|
|
|
var objA = new A();
|
2014-08-12 00:54:12 +02:00
|
|
|
// number type var
|
2014-07-13 01:04:16 +02:00
|
|
|
var ResultIsAny1 = void NUMBER;
|
|
|
|
var ResultIsAny2 = void NUMBER1;
|
2014-08-12 00:54:12 +02:00
|
|
|
// number type literal
|
2014-07-13 01:04:16 +02:00
|
|
|
var ResultIsAny3 = void 1;
|
|
|
|
var ResultIsAny4 = void { x: 1, y: 2 };
|
2015-02-07 05:03:24 +01:00
|
|
|
var ResultIsAny5 = void { x: 1, y: function (n) { return n; } };
|
2014-08-12 00:54:12 +02:00
|
|
|
// number type expressions
|
2014-07-13 01:04:16 +02:00
|
|
|
var ResultIsAny6 = void objA.a;
|
|
|
|
var ResultIsAny7 = void M.n;
|
|
|
|
var ResultIsAny8 = void NUMBER1[0];
|
|
|
|
var ResultIsAny9 = void foo();
|
|
|
|
var ResultIsAny10 = void A.foo();
|
|
|
|
var ResultIsAny11 = void (NUMBER + NUMBER);
|
2014-08-12 00:54:12 +02:00
|
|
|
// multiple void operators
|
2014-07-13 01:04:16 +02:00
|
|
|
var ResultIsAny12 = void void NUMBER;
|
|
|
|
var ResultIsAny13 = void void void (NUMBER + NUMBER);
|
2014-08-16 00:49:09 +02:00
|
|
|
// miss assignment operators
|
2014-07-13 01:04:16 +02:00
|
|
|
void 1;
|
|
|
|
void NUMBER;
|
|
|
|
void NUMBER1;
|
|
|
|
void foo();
|
|
|
|
void objA.a;
|
|
|
|
void M.n;
|
|
|
|
void objA.a, M.n;
|