2014-07-13 01:04:16 +02:00
|
|
|
//// [voidOperatorWithStringType.ts]
|
|
|
|
// void operator on string type
|
|
|
|
var STRING: string;
|
|
|
|
var STRING1: string[] = ["", "abc"];
|
|
|
|
|
|
|
|
function foo(): string { return "abc"; }
|
|
|
|
|
|
|
|
class A {
|
|
|
|
public a: string;
|
|
|
|
static foo() { return ""; }
|
|
|
|
}
|
|
|
|
module M {
|
|
|
|
export var n: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
var objA = new A();
|
|
|
|
|
|
|
|
// string type var
|
|
|
|
var ResultIsAny1 = void STRING;
|
|
|
|
var ResultIsAny2 = void STRING1;
|
|
|
|
|
|
|
|
// string type literal
|
|
|
|
var ResultIsAny3 = void "";
|
|
|
|
var ResultIsAny4 = void { x: "", y: "" };
|
|
|
|
var ResultIsAny5 = void { x: "", y: (s: string) => { return s; } };
|
|
|
|
|
|
|
|
// string type expressions
|
|
|
|
var ResultIsAny6 = void objA.a;
|
|
|
|
var ResultIsAny7 = void M.n;
|
|
|
|
var ResultIsAny8 = void STRING1[0];
|
|
|
|
var ResultIsAny9 = void foo();
|
|
|
|
var ResultIsAny10 = void A.foo();
|
|
|
|
var ResultIsAny11 = void (STRING + STRING);
|
|
|
|
var ResultIsAny12 = void STRING.charAt(0);
|
|
|
|
|
|
|
|
// multiple void operators
|
|
|
|
var ResultIsAny13 = void void STRING;
|
|
|
|
var ResultIsAny14 = void void void (STRING + STRING);
|
|
|
|
|
|
|
|
// miss assignment operators
|
|
|
|
void "";
|
|
|
|
void STRING;
|
|
|
|
void STRING1;
|
|
|
|
void foo();
|
|
|
|
void objA.a,M.n;
|
|
|
|
|
|
|
|
//// [voidOperatorWithStringType.js]
|
2014-08-12 00:54:12 +02:00
|
|
|
// void operator on string type
|
2014-07-13 01:04:16 +02:00
|
|
|
var STRING;
|
|
|
|
var STRING1 = ["", "abc"];
|
|
|
|
function foo() {
|
|
|
|
return "abc";
|
|
|
|
}
|
|
|
|
var A = (function () {
|
|
|
|
function A() {
|
|
|
|
}
|
|
|
|
A.foo = function () {
|
|
|
|
return "";
|
|
|
|
};
|
|
|
|
return A;
|
|
|
|
})();
|
|
|
|
var M;
|
|
|
|
(function (M) {
|
|
|
|
M.n;
|
|
|
|
})(M || (M = {}));
|
|
|
|
var objA = new A();
|
2014-08-12 00:54:12 +02:00
|
|
|
// string type var
|
2014-07-13 01:04:16 +02:00
|
|
|
var ResultIsAny1 = void STRING;
|
|
|
|
var ResultIsAny2 = void STRING1;
|
2014-08-12 00:54:12 +02:00
|
|
|
// string type literal
|
2014-07-13 01:04:16 +02:00
|
|
|
var ResultIsAny3 = void "";
|
|
|
|
var ResultIsAny4 = void { x: "", y: "" };
|
|
|
|
var ResultIsAny5 = void { x: "", y: function (s) {
|
|
|
|
return s;
|
|
|
|
} };
|
2014-08-12 00:54:12 +02:00
|
|
|
// string type expressions
|
2014-07-13 01:04:16 +02:00
|
|
|
var ResultIsAny6 = void objA.a;
|
|
|
|
var ResultIsAny7 = void M.n;
|
|
|
|
var ResultIsAny8 = void STRING1[0];
|
|
|
|
var ResultIsAny9 = void foo();
|
|
|
|
var ResultIsAny10 = void A.foo();
|
|
|
|
var ResultIsAny11 = void (STRING + STRING);
|
|
|
|
var ResultIsAny12 = void STRING.charAt(0);
|
2014-08-12 00:54:12 +02:00
|
|
|
// multiple void operators
|
2014-07-13 01:04:16 +02:00
|
|
|
var ResultIsAny13 = void void STRING;
|
|
|
|
var ResultIsAny14 = void void void (STRING + STRING);
|
2014-08-16 00:49:09 +02:00
|
|
|
// miss assignment operators
|
2014-07-13 01:04:16 +02:00
|
|
|
void "";
|
|
|
|
void STRING;
|
|
|
|
void STRING1;
|
|
|
|
void foo();
|
|
|
|
void objA.a, M.n;
|