mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Added ES5 tests for computed properties.
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(9,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(10,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(11,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(13,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(14,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(15,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts (11 errors) ====
|
||||
var s: string;
|
||||
var n: number;
|
||||
var a: any;
|
||||
var v = {
|
||||
[s]() { },
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[n]() { },
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[s + s]() { },
|
||||
~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[s + n]() { },
|
||||
~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[+s]() { },
|
||||
~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[""]() { },
|
||||
~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[0]() { },
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[a]() { },
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[<any>true]() { },
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[`hello bye`]() { },
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[`hello ${a} bye`]() { }
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
//// [computedPropertyNames10_ES5.ts]
|
||||
var s: string;
|
||||
var n: number;
|
||||
var a: any;
|
||||
var v = {
|
||||
[s]() { },
|
||||
[n]() { },
|
||||
[s + s]() { },
|
||||
[s + n]() { },
|
||||
[+s]() { },
|
||||
[""]() { },
|
||||
[0]() { },
|
||||
[a]() { },
|
||||
[<any>true]() { },
|
||||
[`hello bye`]() { },
|
||||
[`hello ${a} bye`]() { }
|
||||
}
|
||||
|
||||
//// [computedPropertyNames10_ES5.js]
|
||||
var s;
|
||||
var n;
|
||||
var a;
|
||||
var v = {
|
||||
[s]: function () {
|
||||
},
|
||||
[n]: function () {
|
||||
},
|
||||
[s + s]: function () {
|
||||
},
|
||||
[s + n]: function () {
|
||||
},
|
||||
[+s]: function () {
|
||||
},
|
||||
[""]: function () {
|
||||
},
|
||||
[0]: function () {
|
||||
},
|
||||
[a]: function () {
|
||||
},
|
||||
[true]: function () {
|
||||
},
|
||||
["hello bye"]: function () {
|
||||
},
|
||||
["hello " + a + " bye"]: function () {
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,85 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(7,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(7,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(9,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(9,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(10,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(10,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(11,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(11,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(12,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(12,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(13,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(13,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(14,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(14,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(15,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(15,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts (22 errors) ====
|
||||
var s: string;
|
||||
var n: number;
|
||||
var a: any;
|
||||
var v = {
|
||||
get [s]() { return 0; },
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
set [n](v) { },
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
get [s + s]() { return 0; },
|
||||
~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
set [s + n](v) { },
|
||||
~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
get [+s]() { return 0; },
|
||||
~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
set [""](v) { },
|
||||
~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
get [0]() { return 0; },
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
set [a](v) { },
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
get [<any>true]() { return 0; },
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
set [`hello bye`](v) { },
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
get [`hello ${a} bye`]() { return 0; }
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
//// [computedPropertyNames11_ES5.ts]
|
||||
var s: string;
|
||||
var n: number;
|
||||
var a: any;
|
||||
var v = {
|
||||
get [s]() { return 0; },
|
||||
set [n](v) { },
|
||||
get [s + s]() { return 0; },
|
||||
set [s + n](v) { },
|
||||
get [+s]() { return 0; },
|
||||
set [""](v) { },
|
||||
get [0]() { return 0; },
|
||||
set [a](v) { },
|
||||
get [<any>true]() { return 0; },
|
||||
set [`hello bye`](v) { },
|
||||
get [`hello ${a} bye`]() { return 0; }
|
||||
}
|
||||
|
||||
//// [computedPropertyNames11_ES5.js]
|
||||
var s;
|
||||
var n;
|
||||
var a;
|
||||
var v = {
|
||||
get [s]() {
|
||||
return 0;
|
||||
},
|
||||
set [n](v) {
|
||||
},
|
||||
get [s + s]() {
|
||||
return 0;
|
||||
},
|
||||
set [s + n](v) {
|
||||
},
|
||||
get [+s]() {
|
||||
return 0;
|
||||
},
|
||||
set [""](v) {
|
||||
},
|
||||
get [0]() {
|
||||
return 0;
|
||||
},
|
||||
set [a](v) {
|
||||
},
|
||||
get [true]() {
|
||||
return 0;
|
||||
},
|
||||
set ["hello bye"](v) {
|
||||
},
|
||||
get ["hello " + a + " bye"]() {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,52 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(5,5): error TS1166: Computed property names are not allowed in class property declarations.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(6,5): error TS1166: Computed property names are not allowed in class property declarations.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(7,12): error TS1166: Computed property names are not allowed in class property declarations.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(8,5): error TS1166: Computed property names are not allowed in class property declarations.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(9,5): error TS1166: Computed property names are not allowed in class property declarations.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(10,12): error TS1166: Computed property names are not allowed in class property declarations.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(11,5): error TS1166: Computed property names are not allowed in class property declarations.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(12,5): error TS1166: Computed property names are not allowed in class property declarations.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(13,12): error TS1166: Computed property names are not allowed in class property declarations.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(14,5): error TS1166: Computed property names are not allowed in class property declarations.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(15,12): error TS1166: Computed property names are not allowed in class property declarations.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts (11 errors) ====
|
||||
var s: string;
|
||||
var n: number;
|
||||
var a: any;
|
||||
class C {
|
||||
[s]: number;
|
||||
~~~
|
||||
!!! error TS1166: Computed property names are not allowed in class property declarations.
|
||||
[n] = n;
|
||||
~~~
|
||||
!!! error TS1166: Computed property names are not allowed in class property declarations.
|
||||
static [s + s]: string;
|
||||
~~~~~~~
|
||||
!!! error TS1166: Computed property names are not allowed in class property declarations.
|
||||
[s + n] = 2;
|
||||
~~~~~~~
|
||||
!!! error TS1166: Computed property names are not allowed in class property declarations.
|
||||
[+s]: typeof s;
|
||||
~~~~
|
||||
!!! error TS1166: Computed property names are not allowed in class property declarations.
|
||||
static [""]: number;
|
||||
~~~~
|
||||
!!! error TS1166: Computed property names are not allowed in class property declarations.
|
||||
[0]: number;
|
||||
~~~
|
||||
!!! error TS1166: Computed property names are not allowed in class property declarations.
|
||||
[a]: number;
|
||||
~~~
|
||||
!!! error TS1166: Computed property names are not allowed in class property declarations.
|
||||
static [<any>true]: number;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1166: Computed property names are not allowed in class property declarations.
|
||||
[`hello bye`] = 0;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1166: Computed property names are not allowed in class property declarations.
|
||||
static [`hello ${a} bye`] = 0
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1166: Computed property names are not allowed in class property declarations.
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
//// [computedPropertyNames12_ES5.ts]
|
||||
var s: string;
|
||||
var n: number;
|
||||
var a: any;
|
||||
class C {
|
||||
[s]: number;
|
||||
[n] = n;
|
||||
static [s + s]: string;
|
||||
[s + n] = 2;
|
||||
[+s]: typeof s;
|
||||
static [""]: number;
|
||||
[0]: number;
|
||||
[a]: number;
|
||||
static [<any>true]: number;
|
||||
[`hello bye`] = 0;
|
||||
static [`hello ${a} bye`] = 0
|
||||
}
|
||||
|
||||
//// [computedPropertyNames12_ES5.js]
|
||||
var s;
|
||||
var n;
|
||||
var a;
|
||||
var C = (function () {
|
||||
function C() {
|
||||
this[n] = n;
|
||||
this[s + n] = 2;
|
||||
this["hello bye"] = 0;
|
||||
}
|
||||
C["hello " + a + " bye"] = 0;
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,52 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(7,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(9,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(10,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(11,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(13,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(14,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(15,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts (11 errors) ====
|
||||
var s: string;
|
||||
var n: number;
|
||||
var a: any;
|
||||
class C {
|
||||
[s]() {}
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[n]() { }
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
static [s + s]() { }
|
||||
~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[s + n]() { }
|
||||
~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[+s]() { }
|
||||
~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
static [""]() { }
|
||||
~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[0]() { }
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[a]() { }
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
static [<any>true]() { }
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[`hello bye`]() { }
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
static [`hello ${a} bye`]() { }
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
//// [computedPropertyNames13_ES5.ts]
|
||||
var s: string;
|
||||
var n: number;
|
||||
var a: any;
|
||||
class C {
|
||||
[s]() {}
|
||||
[n]() { }
|
||||
static [s + s]() { }
|
||||
[s + n]() { }
|
||||
[+s]() { }
|
||||
static [""]() { }
|
||||
[0]() { }
|
||||
[a]() { }
|
||||
static [<any>true]() { }
|
||||
[`hello bye`]() { }
|
||||
static [`hello ${a} bye`]() { }
|
||||
}
|
||||
|
||||
//// [computedPropertyNames13_ES5.js]
|
||||
var s;
|
||||
var n;
|
||||
var a;
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype[s] = function () {
|
||||
};
|
||||
C.prototype[n] = function () {
|
||||
};
|
||||
C[s + s] = function () {
|
||||
};
|
||||
C.prototype[s + n] = function () {
|
||||
};
|
||||
C.prototype[+s] = function () {
|
||||
};
|
||||
C[""] = function () {
|
||||
};
|
||||
C.prototype[0] = function () {
|
||||
};
|
||||
C.prototype[a] = function () {
|
||||
};
|
||||
C[true] = function () {
|
||||
};
|
||||
C.prototype["hello bye"] = function () {
|
||||
};
|
||||
C["hello " + a + " bye"] = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,48 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(3,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(4,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(6,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(6,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(8,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(8,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts (12 errors) ====
|
||||
var b: boolean;
|
||||
class C {
|
||||
[b]() {}
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
static [true]() { }
|
||||
~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
[[]]() { }
|
||||
~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
static [{}]() { }
|
||||
~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
[undefined]() { }
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
static [null]() { }
|
||||
~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
//// [computedPropertyNames14_ES5.ts]
|
||||
var b: boolean;
|
||||
class C {
|
||||
[b]() {}
|
||||
static [true]() { }
|
||||
[[]]() { }
|
||||
static [{}]() { }
|
||||
[undefined]() { }
|
||||
static [null]() { }
|
||||
}
|
||||
|
||||
//// [computedPropertyNames14_ES5.js]
|
||||
var b;
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype[b] = function () {
|
||||
};
|
||||
C[true] = function () {
|
||||
};
|
||||
C.prototype[[]] = function () {
|
||||
};
|
||||
C[{}] = function () {
|
||||
};
|
||||
C.prototype[undefined] = function () {
|
||||
};
|
||||
C[null] = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,26 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts (5 errors) ====
|
||||
var p1: number | string;
|
||||
var p2: number | number[];
|
||||
var p3: string | boolean;
|
||||
class C {
|
||||
[p1]() { }
|
||||
~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[p2]() { }
|
||||
~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
[p3]() { }
|
||||
~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
//// [computedPropertyNames15_ES5.ts]
|
||||
var p1: number | string;
|
||||
var p2: number | number[];
|
||||
var p3: string | boolean;
|
||||
class C {
|
||||
[p1]() { }
|
||||
[p2]() { }
|
||||
[p3]() { }
|
||||
}
|
||||
|
||||
//// [computedPropertyNames15_ES5.js]
|
||||
var p1;
|
||||
var p2;
|
||||
var p3;
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype[p1] = function () {
|
||||
};
|
||||
C.prototype[p2] = function () {
|
||||
};
|
||||
C.prototype[p3] = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,52 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(7,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(9,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(10,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(11,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(12,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(13,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(14,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(15,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts (11 errors) ====
|
||||
var s: string;
|
||||
var n: number;
|
||||
var a: any;
|
||||
class C {
|
||||
get [s]() { return 0;}
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
set [n](v) { }
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
static get [s + s]() { return 0; }
|
||||
~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
set [s + n](v) { }
|
||||
~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
get [+s]() { return 0; }
|
||||
~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
static set [""](v) { }
|
||||
~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
get [0]() { return 0; }
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
set [a](v) { }
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
static get [<any>true]() { return 0; }
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
set [`hello bye`](v) { }
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
get [`hello ${a} bye`]() { return 0; }
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
//// [computedPropertyNames16_ES5.ts]
|
||||
var s: string;
|
||||
var n: number;
|
||||
var a: any;
|
||||
class C {
|
||||
get [s]() { return 0;}
|
||||
set [n](v) { }
|
||||
static get [s + s]() { return 0; }
|
||||
set [s + n](v) { }
|
||||
get [+s]() { return 0; }
|
||||
static set [""](v) { }
|
||||
get [0]() { return 0; }
|
||||
set [a](v) { }
|
||||
static get [<any>true]() { return 0; }
|
||||
set [`hello bye`](v) { }
|
||||
get [`hello ${a} bye`]() { return 0; }
|
||||
}
|
||||
|
||||
//// [computedPropertyNames16_ES5.js]
|
||||
var s;
|
||||
var n;
|
||||
var a;
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
Object.defineProperty(C.prototype, s, {
|
||||
get: function () {
|
||||
return 0;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, n, {
|
||||
set: function (v) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C, s + s, {
|
||||
get: function () {
|
||||
return 0;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, s + n, {
|
||||
set: function (v) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, +s, {
|
||||
get: function () {
|
||||
return 0;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C, "", {
|
||||
set: function (v) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, 0, {
|
||||
get: function () {
|
||||
return 0;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, a, {
|
||||
set: function (v) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C, true, {
|
||||
get: function () {
|
||||
return 0;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, "hello bye", {
|
||||
set: function (v) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, "hello " + a + " bye", {
|
||||
get: function () {
|
||||
return 0;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,48 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(3,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(3,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(4,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(4,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(7,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(8,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts (12 errors) ====
|
||||
var b: boolean;
|
||||
class C {
|
||||
get [b]() { return 0;}
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
static set [true](v) { }
|
||||
~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
get [[]]() { return 0; }
|
||||
~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
set [{}](v) { }
|
||||
~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
static get [undefined]() { return 0; }
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
set [null](v) { }
|
||||
~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
//// [computedPropertyNames17_ES5.ts]
|
||||
var b: boolean;
|
||||
class C {
|
||||
get [b]() { return 0;}
|
||||
static set [true](v) { }
|
||||
get [[]]() { return 0; }
|
||||
set [{}](v) { }
|
||||
static get [undefined]() { return 0; }
|
||||
set [null](v) { }
|
||||
}
|
||||
|
||||
//// [computedPropertyNames17_ES5.js]
|
||||
var b;
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
Object.defineProperty(C.prototype, b, {
|
||||
get: function () {
|
||||
return 0;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C, true, {
|
||||
set: function (v) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, [], {
|
||||
get: function () {
|
||||
return 0;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, {}, {
|
||||
set: function (v) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C, undefined, {
|
||||
get: function () {
|
||||
return 0;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, null, {
|
||||
set: function (v) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,11 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts(3,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts (1 errors) ====
|
||||
function foo() {
|
||||
var obj = {
|
||||
[this.bar]: 0
|
||||
~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
//// [computedPropertyNames18_ES5.ts]
|
||||
function foo() {
|
||||
var obj = {
|
||||
[this.bar]: 0
|
||||
}
|
||||
}
|
||||
|
||||
//// [computedPropertyNames18_ES5.js]
|
||||
function foo() {
|
||||
var obj = {
|
||||
[this.bar]: 0
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts(3,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts(3,10): error TS2331: 'this' cannot be referenced in a module body.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts (2 errors) ====
|
||||
module M {
|
||||
var obj = {
|
||||
[this.bar]: 0
|
||||
~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~
|
||||
!!! error TS2331: 'this' cannot be referenced in a module body.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
//// [computedPropertyNames19_ES5.ts]
|
||||
module M {
|
||||
var obj = {
|
||||
[this.bar]: 0
|
||||
}
|
||||
}
|
||||
|
||||
//// [computedPropertyNames19_ES5.js]
|
||||
var M;
|
||||
(function (M) {
|
||||
var obj = {
|
||||
[this.bar]: 0
|
||||
};
|
||||
})(M || (M = {}));
|
||||
@@ -0,0 +1,19 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts(2,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts(2,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts(3,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts(3,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts (4 errors) ====
|
||||
var v = {
|
||||
get [0 + 1]() { return 0 },
|
||||
~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
set [0 + 1](v: string) { } //No error
|
||||
~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
//// [computedPropertyNames1_ES5.ts]
|
||||
var v = {
|
||||
get [0 + 1]() { return 0 },
|
||||
set [0 + 1](v: string) { } //No error
|
||||
}
|
||||
|
||||
//// [computedPropertyNames1_ES5.js]
|
||||
var v = {
|
||||
get [0 + 1]() {
|
||||
return 0;
|
||||
},
|
||||
set [0 + 1](v) {
|
||||
} //No error
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts (1 errors) ====
|
||||
var obj = {
|
||||
[this.bar]: 0
|
||||
~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
//// [computedPropertyNames20_ES5.ts]
|
||||
var obj = {
|
||||
[this.bar]: 0
|
||||
}
|
||||
|
||||
//// [computedPropertyNames20_ES5.js]
|
||||
var obj = {
|
||||
[this.bar]: 0
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts(5,6): error TS2465: 'this' cannot be referenced in a computed property name.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts (2 errors) ====
|
||||
class C {
|
||||
bar() {
|
||||
return 0;
|
||||
}
|
||||
[this.bar()]() { }
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~
|
||||
!!! error TS2465: 'this' cannot be referenced in a computed property name.
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
//// [computedPropertyNames21_ES5.ts]
|
||||
class C {
|
||||
bar() {
|
||||
return 0;
|
||||
}
|
||||
[this.bar()]() { }
|
||||
}
|
||||
|
||||
//// [computedPropertyNames21_ES5.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.bar = function () {
|
||||
return 0;
|
||||
};
|
||||
C.prototype[this.bar()] = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,14 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts(4,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts (1 errors) ====
|
||||
class C {
|
||||
bar() {
|
||||
var obj = {
|
||||
[this.bar()]() { }
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
};
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
//// [computedPropertyNames22_ES5.ts]
|
||||
class C {
|
||||
bar() {
|
||||
var obj = {
|
||||
[this.bar()]() { }
|
||||
};
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//// [computedPropertyNames22_ES5.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.bar = function () {
|
||||
var obj = {
|
||||
[this.bar()]: function () {
|
||||
}
|
||||
};
|
||||
return 0;
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,22 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts(6,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts(6,12): error TS2465: 'this' cannot be referenced in a computed property name.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts (3 errors) ====
|
||||
class C {
|
||||
bar() {
|
||||
return 0;
|
||||
}
|
||||
[
|
||||
~
|
||||
{ [this.bar()]: 1 }[0]
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~
|
||||
!!! error TS2465: 'this' cannot be referenced in a computed property name.
|
||||
]() { }
|
||||
~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
//// [computedPropertyNames23_ES5.ts]
|
||||
class C {
|
||||
bar() {
|
||||
return 0;
|
||||
}
|
||||
[
|
||||
{ [this.bar()]: 1 }[0]
|
||||
]() { }
|
||||
}
|
||||
|
||||
//// [computedPropertyNames23_ES5.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.bar = function () {
|
||||
return 0;
|
||||
};
|
||||
C.prototype[{ [this.bar()]: 1 }[0]] = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,19 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts(9,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts(9,6): error TS2466: 'super' cannot be referenced in a computed property name.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts (2 errors) ====
|
||||
class Base {
|
||||
bar() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
class C extends Base {
|
||||
// Gets emitted as super, not _super, which is consistent with
|
||||
// use of super in static properties initializers.
|
||||
[super.bar()]() { }
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~
|
||||
!!! error TS2466: 'super' cannot be referenced in a computed property name.
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
//// [computedPropertyNames24_ES5.ts]
|
||||
class Base {
|
||||
bar() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
class C extends Base {
|
||||
// Gets emitted as super, not _super, which is consistent with
|
||||
// use of super in static properties initializers.
|
||||
[super.bar()]() { }
|
||||
}
|
||||
|
||||
//// [computedPropertyNames24_ES5.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var Base = (function () {
|
||||
function Base() {
|
||||
}
|
||||
Base.prototype.bar = function () {
|
||||
return 0;
|
||||
};
|
||||
return Base;
|
||||
})();
|
||||
var C = (function (_super) {
|
||||
__extends(C, _super);
|
||||
function C() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
// Gets emitted as super, not _super, which is consistent with
|
||||
// use of super in static properties initializers.
|
||||
C.prototype[super.bar.call(this)] = function () {
|
||||
};
|
||||
return C;
|
||||
})(Base);
|
||||
@@ -0,0 +1,19 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts(9,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts (1 errors) ====
|
||||
class Base {
|
||||
bar() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
class C extends Base {
|
||||
foo() {
|
||||
var obj = {
|
||||
[super.bar()]() { }
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
};
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
//// [computedPropertyNames25_ES5.ts]
|
||||
class Base {
|
||||
bar() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
class C extends Base {
|
||||
foo() {
|
||||
var obj = {
|
||||
[super.bar()]() { }
|
||||
};
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//// [computedPropertyNames25_ES5.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var Base = (function () {
|
||||
function Base() {
|
||||
}
|
||||
Base.prototype.bar = function () {
|
||||
return 0;
|
||||
};
|
||||
return Base;
|
||||
})();
|
||||
var C = (function (_super) {
|
||||
__extends(C, _super);
|
||||
function C() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
C.prototype.foo = function () {
|
||||
var obj = {
|
||||
[_super.prototype.bar.call(this)]: function () {
|
||||
}
|
||||
};
|
||||
return 0;
|
||||
};
|
||||
return C;
|
||||
})(Base);
|
||||
@@ -0,0 +1,26 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts(9,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts(10,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts(10,12): error TS2466: 'super' cannot be referenced in a computed property name.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts (3 errors) ====
|
||||
class Base {
|
||||
bar() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
class C extends Base {
|
||||
// Gets emitted as super, not _super, which is consistent with
|
||||
// use of super in static properties initializers.
|
||||
[
|
||||
~
|
||||
{ [super.bar()]: 1 }[0]
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~
|
||||
!!! error TS2466: 'super' cannot be referenced in a computed property name.
|
||||
]() { }
|
||||
~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
//// [computedPropertyNames26_ES5.ts]
|
||||
class Base {
|
||||
bar() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
class C extends Base {
|
||||
// Gets emitted as super, not _super, which is consistent with
|
||||
// use of super in static properties initializers.
|
||||
[
|
||||
{ [super.bar()]: 1 }[0]
|
||||
]() { }
|
||||
}
|
||||
|
||||
//// [computedPropertyNames26_ES5.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var Base = (function () {
|
||||
function Base() {
|
||||
}
|
||||
Base.prototype.bar = function () {
|
||||
return 0;
|
||||
};
|
||||
return Base;
|
||||
})();
|
||||
var C = (function (_super) {
|
||||
__extends(C, _super);
|
||||
function C() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
// Gets emitted as super, not _super, which is consistent with
|
||||
// use of super in static properties initializers.
|
||||
C.prototype[{ [super.bar.call(this)]: 1 }[0]] = function () {
|
||||
};
|
||||
return C;
|
||||
})(Base);
|
||||
@@ -0,0 +1,14 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts(4,7): error TS2466: 'super' cannot be referenced in a computed property name.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts (2 errors) ====
|
||||
class Base {
|
||||
}
|
||||
class C extends Base {
|
||||
[(super(), "prop")]() { }
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~
|
||||
!!! error TS2466: 'super' cannot be referenced in a computed property name.
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
//// [computedPropertyNames27_ES5.ts]
|
||||
class Base {
|
||||
}
|
||||
class C extends Base {
|
||||
[(super(), "prop")]() { }
|
||||
}
|
||||
|
||||
//// [computedPropertyNames27_ES5.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var Base = (function () {
|
||||
function Base() {
|
||||
}
|
||||
return Base;
|
||||
})();
|
||||
var C = (function (_super) {
|
||||
__extends(C, _super);
|
||||
function C() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
C.prototype[(_super.call(this), "prop")] = function () {
|
||||
};
|
||||
return C;
|
||||
})(Base);
|
||||
@@ -0,0 +1,16 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts(7,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts (1 errors) ====
|
||||
class Base {
|
||||
}
|
||||
class C extends Base {
|
||||
constructor() {
|
||||
super();
|
||||
var obj = {
|
||||
[(super(), "prop")]() { }
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//// [computedPropertyNames28_ES5.ts]
|
||||
class Base {
|
||||
}
|
||||
class C extends Base {
|
||||
constructor() {
|
||||
super();
|
||||
var obj = {
|
||||
[(super(), "prop")]() { }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
//// [computedPropertyNames28_ES5.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var Base = (function () {
|
||||
function Base() {
|
||||
}
|
||||
return Base;
|
||||
})();
|
||||
var C = (function (_super) {
|
||||
__extends(C, _super);
|
||||
function C() {
|
||||
_super.call(this);
|
||||
var obj = {
|
||||
[(_super.call(this), "prop")]: function () {
|
||||
}
|
||||
};
|
||||
}
|
||||
return C;
|
||||
})(Base);
|
||||
@@ -0,0 +1,16 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts(5,17): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts (1 errors) ====
|
||||
class C {
|
||||
bar() {
|
||||
() => {
|
||||
var obj = {
|
||||
[this.bar()]() { } // needs capture
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
};
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
//// [computedPropertyNames29_ES5.ts]
|
||||
class C {
|
||||
bar() {
|
||||
() => {
|
||||
var obj = {
|
||||
[this.bar()]() { } // needs capture
|
||||
};
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//// [computedPropertyNames29_ES5.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.bar = function () {
|
||||
var _this = this;
|
||||
(function () {
|
||||
var obj = {
|
||||
[_this.bar()]: function () {
|
||||
} // needs capture
|
||||
};
|
||||
});
|
||||
return 0;
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,37 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(5,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(6,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(7,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(8,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(8,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(9,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts (8 errors) ====
|
||||
var methodName = "method";
|
||||
var accessorName = "accessor";
|
||||
class C {
|
||||
[methodName]() { }
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
static [methodName]() { }
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
get [accessorName]() { }
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
||||
set [accessorName](v) { }
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
static get [accessorName]() { }
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
||||
static set [accessorName](v) { }
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
//// [computedPropertyNames2_ES5.ts]
|
||||
var methodName = "method";
|
||||
var accessorName = "accessor";
|
||||
class C {
|
||||
[methodName]() { }
|
||||
static [methodName]() { }
|
||||
get [accessorName]() { }
|
||||
set [accessorName](v) { }
|
||||
static get [accessorName]() { }
|
||||
static set [accessorName](v) { }
|
||||
}
|
||||
|
||||
//// [computedPropertyNames2_ES5.js]
|
||||
var methodName = "method";
|
||||
var accessorName = "accessor";
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype[methodName] = function () {
|
||||
};
|
||||
C[methodName] = function () {
|
||||
};
|
||||
Object.defineProperty(C.prototype, accessorName, {
|
||||
get: function () {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, accessorName, {
|
||||
set: function (v) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C, accessorName, {
|
||||
get: function () {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C, accessorName, {
|
||||
set: function (v) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,24 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts(11,17): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts(11,19): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts (2 errors) ====
|
||||
class Base {
|
||||
}
|
||||
class C extends Base {
|
||||
constructor() {
|
||||
super();
|
||||
() => {
|
||||
var obj = {
|
||||
// Ideally, we would capture this. But the reference is
|
||||
// illegal, and not capturing this is consistent with
|
||||
//treatment of other similar violations.
|
||||
[(super(), "prop")]() { }
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~
|
||||
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
//// [computedPropertyNames30_ES5.ts]
|
||||
class Base {
|
||||
}
|
||||
class C extends Base {
|
||||
constructor() {
|
||||
super();
|
||||
() => {
|
||||
var obj = {
|
||||
// Ideally, we would capture this. But the reference is
|
||||
// illegal, and not capturing this is consistent with
|
||||
//treatment of other similar violations.
|
||||
[(super(), "prop")]() { }
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//// [computedPropertyNames30_ES5.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var Base = (function () {
|
||||
function Base() {
|
||||
}
|
||||
return Base;
|
||||
})();
|
||||
var C = (function (_super) {
|
||||
__extends(C, _super);
|
||||
function C() {
|
||||
_super.call(this);
|
||||
(function () {
|
||||
var obj = {
|
||||
// Ideally, we would capture this. But the reference is
|
||||
// illegal, and not capturing this is consistent with
|
||||
//treatment of other similar violations.
|
||||
[(_super.call(this), "prop")]: function () {
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
return C;
|
||||
})(Base);
|
||||
@@ -0,0 +1,21 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts(10,17): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts (1 errors) ====
|
||||
class Base {
|
||||
bar() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
class C extends Base {
|
||||
foo() {
|
||||
() => {
|
||||
var obj = {
|
||||
[super.bar()]() { } // needs capture
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
};
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
//// [computedPropertyNames31_ES5.ts]
|
||||
class Base {
|
||||
bar() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
class C extends Base {
|
||||
foo() {
|
||||
() => {
|
||||
var obj = {
|
||||
[super.bar()]() { } // needs capture
|
||||
};
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//// [computedPropertyNames31_ES5.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var Base = (function () {
|
||||
function Base() {
|
||||
}
|
||||
Base.prototype.bar = function () {
|
||||
return 0;
|
||||
};
|
||||
return Base;
|
||||
})();
|
||||
var C = (function (_super) {
|
||||
__extends(C, _super);
|
||||
function C() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
C.prototype.foo = function () {
|
||||
var _this = this;
|
||||
(function () {
|
||||
var obj = {
|
||||
[_super.prototype.bar.call(_this)]: function () {
|
||||
} // needs capture
|
||||
};
|
||||
});
|
||||
return 0;
|
||||
};
|
||||
return C;
|
||||
})(Base);
|
||||
@@ -0,0 +1,16 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts(6,10): error TS2466: A computed property name cannot reference a type parameter from its containing type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts (2 errors) ====
|
||||
function foo<T>() { return '' }
|
||||
class C<T> {
|
||||
bar() {
|
||||
return 0;
|
||||
}
|
||||
[foo<T>()]() { }
|
||||
~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~
|
||||
!!! error TS2466: A computed property name cannot reference a type parameter from its containing type.
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
//// [computedPropertyNames32_ES5.ts]
|
||||
function foo<T>() { return '' }
|
||||
class C<T> {
|
||||
bar() {
|
||||
return 0;
|
||||
}
|
||||
[foo<T>()]() { }
|
||||
}
|
||||
|
||||
//// [computedPropertyNames32_ES5.js]
|
||||
function foo() {
|
||||
return '';
|
||||
}
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.bar = function () {
|
||||
return 0;
|
||||
};
|
||||
C.prototype[foo()] = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,15 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts(5,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts (1 errors) ====
|
||||
function foo<T>() { return '' }
|
||||
class C<T> {
|
||||
bar() {
|
||||
var obj = {
|
||||
[foo<T>()]() { }
|
||||
~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
};
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
//// [computedPropertyNames33_ES5.ts]
|
||||
function foo<T>() { return '' }
|
||||
class C<T> {
|
||||
bar() {
|
||||
var obj = {
|
||||
[foo<T>()]() { }
|
||||
};
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//// [computedPropertyNames33_ES5.js]
|
||||
function foo() {
|
||||
return '';
|
||||
}
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.bar = function () {
|
||||
var obj = {
|
||||
[foo()]: function () {
|
||||
}
|
||||
};
|
||||
return 0;
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,18 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts(5,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts(5,18): error TS2302: Static members cannot reference class type parameters.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts (2 errors) ====
|
||||
function foo<T>() { return '' }
|
||||
class C<T> {
|
||||
static bar() {
|
||||
var obj = {
|
||||
[foo<T>()]() { }
|
||||
~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~
|
||||
!!! error TS2302: Static members cannot reference class type parameters.
|
||||
};
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
//// [computedPropertyNames34_ES5.ts]
|
||||
function foo<T>() { return '' }
|
||||
class C<T> {
|
||||
static bar() {
|
||||
var obj = {
|
||||
[foo<T>()]() { }
|
||||
};
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//// [computedPropertyNames34_ES5.js]
|
||||
function foo() {
|
||||
return '';
|
||||
}
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.bar = function () {
|
||||
var obj = {
|
||||
[foo()]: function () {
|
||||
}
|
||||
};
|
||||
return 0;
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,14 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts(4,5): error TS1169: Computed property names are not allowed in interfaces.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts(4,10): error TS2466: A computed property name cannot reference a type parameter from its containing type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts (2 errors) ====
|
||||
function foo<T>() { return '' }
|
||||
interface I<T> {
|
||||
bar(): string;
|
||||
[foo<T>()](): void;
|
||||
~~~~~~~~~~
|
||||
!!! error TS1169: Computed property names are not allowed in interfaces.
|
||||
~
|
||||
!!! error TS2466: A computed property name cannot reference a type parameter from its containing type.
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
//// [computedPropertyNames35_ES5.ts]
|
||||
function foo<T>() { return '' }
|
||||
interface I<T> {
|
||||
bar(): string;
|
||||
[foo<T>()](): void;
|
||||
}
|
||||
|
||||
//// [computedPropertyNames35_ES5.js]
|
||||
function foo() {
|
||||
return '';
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts(8,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts(9,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts (3 errors) ====
|
||||
class Foo { x }
|
||||
class Foo2 { x; y }
|
||||
|
||||
class C {
|
||||
[s: string]: Foo2;
|
||||
|
||||
// Computed properties
|
||||
get ["get1"]() { return new Foo }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
|
||||
~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
set ["set1"](p: Foo2) { }
|
||||
~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
//// [computedPropertyNames36_ES5.ts]
|
||||
class Foo { x }
|
||||
class Foo2 { x; y }
|
||||
|
||||
class C {
|
||||
[s: string]: Foo2;
|
||||
|
||||
// Computed properties
|
||||
get ["get1"]() { return new Foo }
|
||||
set ["set1"](p: Foo2) { }
|
||||
}
|
||||
|
||||
//// [computedPropertyNames36_ES5.js]
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
}
|
||||
return Foo;
|
||||
})();
|
||||
var Foo2 = (function () {
|
||||
function Foo2() {
|
||||
}
|
||||
return Foo2;
|
||||
})();
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
Object.defineProperty(C.prototype, "get1", {
|
||||
// Computed properties
|
||||
get: function () {
|
||||
return new Foo;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, "set1", {
|
||||
set: function (p) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,19 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts(9,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts (2 errors) ====
|
||||
class Foo { x }
|
||||
class Foo2 { x; y }
|
||||
|
||||
class C {
|
||||
[s: number]: Foo2;
|
||||
|
||||
// Computed properties
|
||||
get ["get1"]() { return new Foo }
|
||||
~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
set ["set1"](p: Foo2) { }
|
||||
~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
//// [computedPropertyNames37_ES5.ts]
|
||||
class Foo { x }
|
||||
class Foo2 { x; y }
|
||||
|
||||
class C {
|
||||
[s: number]: Foo2;
|
||||
|
||||
// Computed properties
|
||||
get ["get1"]() { return new Foo }
|
||||
set ["set1"](p: Foo2) { }
|
||||
}
|
||||
|
||||
//// [computedPropertyNames37_ES5.js]
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
}
|
||||
return Foo;
|
||||
})();
|
||||
var Foo2 = (function () {
|
||||
function Foo2() {
|
||||
}
|
||||
return Foo2;
|
||||
})();
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
Object.defineProperty(C.prototype, "get1", {
|
||||
// Computed properties
|
||||
get: function () {
|
||||
return new Foo;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, "set1", {
|
||||
set: function (p) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,22 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts(8,5): error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts(9,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts (3 errors) ====
|
||||
class Foo { x }
|
||||
class Foo2 { x; y }
|
||||
|
||||
class C {
|
||||
[s: string]: Foo2;
|
||||
|
||||
// Computed properties
|
||||
get [1 << 6]() { return new Foo }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'.
|
||||
~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
set [1 << 6](p: Foo2) { }
|
||||
~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
//// [computedPropertyNames38_ES5.ts]
|
||||
class Foo { x }
|
||||
class Foo2 { x; y }
|
||||
|
||||
class C {
|
||||
[s: string]: Foo2;
|
||||
|
||||
// Computed properties
|
||||
get [1 << 6]() { return new Foo }
|
||||
set [1 << 6](p: Foo2) { }
|
||||
}
|
||||
|
||||
//// [computedPropertyNames38_ES5.js]
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
}
|
||||
return Foo;
|
||||
})();
|
||||
var Foo2 = (function () {
|
||||
function Foo2() {
|
||||
}
|
||||
return Foo2;
|
||||
})();
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
Object.defineProperty(C.prototype, 1 << 6, {
|
||||
// Computed properties
|
||||
get: function () {
|
||||
return new Foo;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, 1 << 6, {
|
||||
set: function (p) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,22 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts(8,5): error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts(9,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts (3 errors) ====
|
||||
class Foo { x }
|
||||
class Foo2 { x; y }
|
||||
|
||||
class C {
|
||||
[s: number]: Foo2;
|
||||
|
||||
// Computed properties
|
||||
get [1 << 6]() { return new Foo }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'.
|
||||
~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
set [1 << 6](p: Foo2) { }
|
||||
~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
//// [computedPropertyNames39_ES5.ts]
|
||||
class Foo { x }
|
||||
class Foo2 { x; y }
|
||||
|
||||
class C {
|
||||
[s: number]: Foo2;
|
||||
|
||||
// Computed properties
|
||||
get [1 << 6]() { return new Foo }
|
||||
set [1 << 6](p: Foo2) { }
|
||||
}
|
||||
|
||||
//// [computedPropertyNames39_ES5.js]
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
}
|
||||
return Foo;
|
||||
})();
|
||||
var Foo2 = (function () {
|
||||
function Foo2() {
|
||||
}
|
||||
return Foo2;
|
||||
})();
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
Object.defineProperty(C.prototype, 1 << 6, {
|
||||
// Computed properties
|
||||
get: function () {
|
||||
return new Foo;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, 1 << 6, {
|
||||
set: function (p) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,48 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(3,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(4,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(8,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts (12 errors) ====
|
||||
var id;
|
||||
class C {
|
||||
[0 + 1]() { }
|
||||
~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
static [() => { }]() { }
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
get [delete id]() { }
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
set [[0, 1]](v) { }
|
||||
~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
static get [<String>""]() { }
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
static set [id.toString()](v) { }
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
//// [computedPropertyNames3_ES5.ts]
|
||||
var id;
|
||||
class C {
|
||||
[0 + 1]() { }
|
||||
static [() => { }]() { }
|
||||
get [delete id]() { }
|
||||
set [[0, 1]](v) { }
|
||||
static get [<String>""]() { }
|
||||
static set [id.toString()](v) { }
|
||||
}
|
||||
|
||||
//// [computedPropertyNames3_ES5.js]
|
||||
var id;
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype[0 + 1] = function () {
|
||||
};
|
||||
C[function () {
|
||||
}] = function () {
|
||||
};
|
||||
Object.defineProperty(C.prototype, delete id, {
|
||||
get: function () {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, [0, 1], {
|
||||
set: function (v) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C, "", {
|
||||
get: function () {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C, id.toString(), {
|
||||
set: function (v) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,22 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts(8,5): error TS2411: Property '[""]' of type '() => Foo' is not assignable to string index type '() => Foo2'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts(9,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts (3 errors) ====
|
||||
class Foo { x }
|
||||
class Foo2 { x; y }
|
||||
|
||||
class C {
|
||||
[s: string]: () => Foo2;
|
||||
|
||||
// Computed properties
|
||||
[""]() { return new Foo }
|
||||
~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2411: Property '[""]' of type '() => Foo' is not assignable to string index type '() => Foo2'.
|
||||
[""]() { return new Foo2 }
|
||||
~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//// [computedPropertyNames40_ES5.ts]
|
||||
class Foo { x }
|
||||
class Foo2 { x; y }
|
||||
|
||||
class C {
|
||||
[s: string]: () => Foo2;
|
||||
|
||||
// Computed properties
|
||||
[""]() { return new Foo }
|
||||
[""]() { return new Foo2 }
|
||||
}
|
||||
|
||||
//// [computedPropertyNames40_ES5.js]
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
}
|
||||
return Foo;
|
||||
})();
|
||||
var Foo2 = (function () {
|
||||
function Foo2() {
|
||||
}
|
||||
return Foo2;
|
||||
})();
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
// Computed properties
|
||||
C.prototype[""] = function () {
|
||||
return new Foo;
|
||||
};
|
||||
C.prototype[""] = function () {
|
||||
return new Foo2;
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,15 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts(8,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts (1 errors) ====
|
||||
class Foo { x }
|
||||
class Foo2 { x; y }
|
||||
|
||||
class C {
|
||||
[s: string]: () => Foo2;
|
||||
|
||||
// Computed properties
|
||||
static [""]() { return new Foo }
|
||||
~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
//// [computedPropertyNames41_ES5.ts]
|
||||
class Foo { x }
|
||||
class Foo2 { x; y }
|
||||
|
||||
class C {
|
||||
[s: string]: () => Foo2;
|
||||
|
||||
// Computed properties
|
||||
static [""]() { return new Foo }
|
||||
}
|
||||
|
||||
//// [computedPropertyNames41_ES5.js]
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
}
|
||||
return Foo;
|
||||
})();
|
||||
var Foo2 = (function () {
|
||||
function Foo2() {
|
||||
}
|
||||
return Foo2;
|
||||
})();
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
// Computed properties
|
||||
C[""] = function () {
|
||||
return new Foo;
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,18 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts(8,5): error TS1166: Computed property names are not allowed in class property declarations.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts(8,5): error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts (2 errors) ====
|
||||
class Foo { x }
|
||||
class Foo2 { x; y }
|
||||
|
||||
class C {
|
||||
[s: string]: Foo2;
|
||||
|
||||
// Computed properties
|
||||
[""]: Foo;
|
||||
~~~~
|
||||
!!! error TS1166: Computed property names are not allowed in class property declarations.
|
||||
~~~~~~~~~~
|
||||
!!! error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'.
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
//// [computedPropertyNames42_ES5.ts]
|
||||
class Foo { x }
|
||||
class Foo2 { x; y }
|
||||
|
||||
class C {
|
||||
[s: string]: Foo2;
|
||||
|
||||
// Computed properties
|
||||
[""]: Foo;
|
||||
}
|
||||
|
||||
//// [computedPropertyNames42_ES5.js]
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
}
|
||||
return Foo;
|
||||
})();
|
||||
var Foo2 = (function () {
|
||||
function Foo2() {
|
||||
}
|
||||
return Foo2;
|
||||
})();
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,24 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts(10,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts(10,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts(11,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts (3 errors) ====
|
||||
class Foo { x }
|
||||
class Foo2 { x; y }
|
||||
|
||||
class C {
|
||||
[s: string]: Foo2;
|
||||
}
|
||||
|
||||
class D extends C {
|
||||
// Computed properties
|
||||
get ["get1"]() { return new Foo }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
|
||||
~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
set ["set1"](p: Foo2) { }
|
||||
~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
//// [computedPropertyNames43_ES5.ts]
|
||||
class Foo { x }
|
||||
class Foo2 { x; y }
|
||||
|
||||
class C {
|
||||
[s: string]: Foo2;
|
||||
}
|
||||
|
||||
class D extends C {
|
||||
// Computed properties
|
||||
get ["get1"]() { return new Foo }
|
||||
set ["set1"](p: Foo2) { }
|
||||
}
|
||||
|
||||
//// [computedPropertyNames43_ES5.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
}
|
||||
return Foo;
|
||||
})();
|
||||
var Foo2 = (function () {
|
||||
function Foo2() {
|
||||
}
|
||||
return Foo2;
|
||||
})();
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
var D = (function (_super) {
|
||||
__extends(D, _super);
|
||||
function D() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
Object.defineProperty(D.prototype, "get1", {
|
||||
// Computed properties
|
||||
get: function () {
|
||||
return new Foo;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(D.prototype, "set1", {
|
||||
set: function (p) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return D;
|
||||
})(C);
|
||||
@@ -0,0 +1,26 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(6,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(10,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(10,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts (4 errors) ====
|
||||
class Foo { x }
|
||||
class Foo2 { x; y }
|
||||
|
||||
class C {
|
||||
[s: string]: Foo2;
|
||||
get ["get1"]() { return new Foo }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
|
||||
~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}
|
||||
|
||||
class D extends C {
|
||||
set ["set1"](p: Foo) { }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
|
||||
~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
//// [computedPropertyNames44_ES5.ts]
|
||||
class Foo { x }
|
||||
class Foo2 { x; y }
|
||||
|
||||
class C {
|
||||
[s: string]: Foo2;
|
||||
get ["get1"]() { return new Foo }
|
||||
}
|
||||
|
||||
class D extends C {
|
||||
set ["set1"](p: Foo) { }
|
||||
}
|
||||
|
||||
//// [computedPropertyNames44_ES5.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
}
|
||||
return Foo;
|
||||
})();
|
||||
var Foo2 = (function () {
|
||||
function Foo2() {
|
||||
}
|
||||
return Foo2;
|
||||
})();
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
Object.defineProperty(C.prototype, "get1", {
|
||||
get: function () {
|
||||
return new Foo;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return C;
|
||||
})();
|
||||
var D = (function (_super) {
|
||||
__extends(D, _super);
|
||||
function D() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
Object.defineProperty(D.prototype, "set1", {
|
||||
set: function (p) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return D;
|
||||
})(C);
|
||||
@@ -0,0 +1,24 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(11,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(11,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts (3 errors) ====
|
||||
class Foo { x }
|
||||
class Foo2 { x; y }
|
||||
|
||||
class C {
|
||||
get ["get1"]() { return new Foo }
|
||||
~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}
|
||||
|
||||
class D extends C {
|
||||
// No error when the indexer is in a class more derived than the computed property
|
||||
[s: string]: Foo2;
|
||||
set ["set1"](p: Foo) { }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
|
||||
~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
//// [computedPropertyNames45_ES5.ts]
|
||||
class Foo { x }
|
||||
class Foo2 { x; y }
|
||||
|
||||
class C {
|
||||
get ["get1"]() { return new Foo }
|
||||
}
|
||||
|
||||
class D extends C {
|
||||
// No error when the indexer is in a class more derived than the computed property
|
||||
[s: string]: Foo2;
|
||||
set ["set1"](p: Foo) { }
|
||||
}
|
||||
|
||||
//// [computedPropertyNames45_ES5.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
}
|
||||
return Foo;
|
||||
})();
|
||||
var Foo2 = (function () {
|
||||
function Foo2() {
|
||||
}
|
||||
return Foo2;
|
||||
})();
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
Object.defineProperty(C.prototype, "get1", {
|
||||
get: function () {
|
||||
return new Foo;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return C;
|
||||
})();
|
||||
var D = (function (_super) {
|
||||
__extends(D, _super);
|
||||
function D() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
Object.defineProperty(D.prototype, "set1", {
|
||||
set: function (p) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return D;
|
||||
})(C);
|
||||
@@ -0,0 +1,9 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts (1 errors) ====
|
||||
var o = {
|
||||
["" || 0]: 0
|
||||
~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
//// [computedPropertyNames46_ES5.ts]
|
||||
var o = {
|
||||
["" || 0]: 0
|
||||
};
|
||||
|
||||
//// [computedPropertyNames46_ES5.js]
|
||||
var o = {
|
||||
["" || 0]: 0
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts (1 errors) ====
|
||||
enum E1 { x }
|
||||
enum E2 { x }
|
||||
var o = {
|
||||
[E1.x || E2.x]: 0
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
//// [computedPropertyNames47_ES5.ts]
|
||||
enum E1 { x }
|
||||
enum E2 { x }
|
||||
var o = {
|
||||
[E1.x || E2.x]: 0
|
||||
};
|
||||
|
||||
//// [computedPropertyNames47_ES5.js]
|
||||
var E1;
|
||||
(function (E1) {
|
||||
E1[E1["x"] = 0] = "x";
|
||||
})(E1 || (E1 = {}));
|
||||
var E2;
|
||||
(function (E2) {
|
||||
E2[E2["x"] = 0] = "x";
|
||||
})(E2 || (E2 = {}));
|
||||
var o = {
|
||||
[0 /* x */ || 0 /* x */]: 0
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts(16,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts(16,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts (6 errors) ====
|
||||
declare function extractIndexer<T>(p: { [n: number]: T }): T;
|
||||
|
||||
enum E { x }
|
||||
|
||||
var a: any;
|
||||
|
||||
extractIndexer({
|
||||
[a]: ""
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}); // Should return string
|
||||
|
||||
extractIndexer({
|
||||
[E.x]: ""
|
||||
~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}); // Should return string
|
||||
|
||||
extractIndexer({
|
||||
["" || 0]: ""
|
||||
~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}); // Should return any (widened form of undefined)
|
||||
@@ -0,0 +1,34 @@
|
||||
//// [computedPropertyNames48_ES5.ts]
|
||||
declare function extractIndexer<T>(p: { [n: number]: T }): T;
|
||||
|
||||
enum E { x }
|
||||
|
||||
var a: any;
|
||||
|
||||
extractIndexer({
|
||||
[a]: ""
|
||||
}); // Should return string
|
||||
|
||||
extractIndexer({
|
||||
[E.x]: ""
|
||||
}); // Should return string
|
||||
|
||||
extractIndexer({
|
||||
["" || 0]: ""
|
||||
}); // Should return any (widened form of undefined)
|
||||
|
||||
//// [computedPropertyNames48_ES5.js]
|
||||
var E;
|
||||
(function (E) {
|
||||
E[E["x"] = 0] = "x";
|
||||
})(E || (E = {}));
|
||||
var a;
|
||||
extractIndexer({
|
||||
[a]: ""
|
||||
}); // Should return string
|
||||
extractIndexer({
|
||||
[0 /* x */]: ""
|
||||
}); // Should return string
|
||||
extractIndexer({
|
||||
["" || 0]: ""
|
||||
}); // Should return any (widened form of undefined)
|
||||
@@ -0,0 +1,52 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(9,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(10,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(11,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(13,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(14,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(15,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts (11 errors) ====
|
||||
var s: string;
|
||||
var n: number;
|
||||
var a: any;
|
||||
var v = {
|
||||
[s]: 0,
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[n]: n,
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[s + s]: 1,
|
||||
~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[s + n]: 2,
|
||||
~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[+s]: s,
|
||||
~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[""]: 0,
|
||||
~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[0]: 0,
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[a]: 1,
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[<any>true]: 0,
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[`hello bye`]: 0,
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[`hello ${a} bye`]: 0
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//// [computedPropertyNames4_ES5.ts]
|
||||
var s: string;
|
||||
var n: number;
|
||||
var a: any;
|
||||
var v = {
|
||||
[s]: 0,
|
||||
[n]: n,
|
||||
[s + s]: 1,
|
||||
[s + n]: 2,
|
||||
[+s]: s,
|
||||
[""]: 0,
|
||||
[0]: 0,
|
||||
[a]: 1,
|
||||
[<any>true]: 0,
|
||||
[`hello bye`]: 0,
|
||||
[`hello ${a} bye`]: 0
|
||||
}
|
||||
|
||||
//// [computedPropertyNames4_ES5.js]
|
||||
var s;
|
||||
var n;
|
||||
var a;
|
||||
var v = {
|
||||
[s]: 0,
|
||||
[n]: n,
|
||||
[s + s]: 1,
|
||||
[s + n]: 2,
|
||||
[+s]: s,
|
||||
[""]: 0,
|
||||
[0]: 0,
|
||||
[a]: 1,
|
||||
[true]: 0,
|
||||
["hello bye"]: 0,
|
||||
["hello " + a + " bye"]: 0
|
||||
};
|
||||
@@ -0,0 +1,48 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(3,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(8,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts (12 errors) ====
|
||||
var b: boolean;
|
||||
var v = {
|
||||
[b]: 0,
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
[true]: 1,
|
||||
~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
[[]]: 0,
|
||||
~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
[{}]: 0,
|
||||
~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
[undefined]: undefined,
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
[null]: null
|
||||
~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
//// [computedPropertyNames5_ES5.ts]
|
||||
var b: boolean;
|
||||
var v = {
|
||||
[b]: 0,
|
||||
[true]: 1,
|
||||
[[]]: 0,
|
||||
[{}]: 0,
|
||||
[undefined]: undefined,
|
||||
[null]: null
|
||||
}
|
||||
|
||||
//// [computedPropertyNames5_ES5.js]
|
||||
var b;
|
||||
var v = {
|
||||
[b]: 0,
|
||||
[true]: 1,
|
||||
[[]]: 0,
|
||||
[{}]: 0,
|
||||
[undefined]: undefined,
|
||||
[null]: null
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts (5 errors) ====
|
||||
var p1: number | string;
|
||||
var p2: number | number[];
|
||||
var p3: string | boolean;
|
||||
var v = {
|
||||
[p1]: 0,
|
||||
~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[p2]: 1,
|
||||
~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
[p3]: 2
|
||||
~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
//// [computedPropertyNames6_ES5.ts]
|
||||
var p1: number | string;
|
||||
var p2: number | number[];
|
||||
var p3: string | boolean;
|
||||
var v = {
|
||||
[p1]: 0,
|
||||
[p2]: 1,
|
||||
[p3]: 2
|
||||
}
|
||||
|
||||
//// [computedPropertyNames6_ES5.js]
|
||||
var p1;
|
||||
var p2;
|
||||
var p3;
|
||||
var v = {
|
||||
[p1]: 0,
|
||||
[p2]: 1,
|
||||
[p3]: 2
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts (1 errors) ====
|
||||
enum E {
|
||||
member
|
||||
}
|
||||
var v = {
|
||||
[E.member]: 0
|
||||
~~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
//// [computedPropertyNames7_ES5.ts]
|
||||
enum E {
|
||||
member
|
||||
}
|
||||
var v = {
|
||||
[E.member]: 0
|
||||
}
|
||||
|
||||
//// [computedPropertyNames7_ES5.js]
|
||||
var E;
|
||||
(function (E) {
|
||||
E[E["member"] = 0] = "member";
|
||||
})(E || (E = {}));
|
||||
var v = {
|
||||
[0 /* member */]: 0
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts (4 errors) ====
|
||||
function f<T, U extends string>() {
|
||||
var t: T;
|
||||
var u: U;
|
||||
var v = {
|
||||
[t]: 0,
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
[u]: 1
|
||||
~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
//// [computedPropertyNames8_ES5.ts]
|
||||
function f<T, U extends string>() {
|
||||
var t: T;
|
||||
var u: U;
|
||||
var v = {
|
||||
[t]: 0,
|
||||
[u]: 1
|
||||
};
|
||||
}
|
||||
|
||||
//// [computedPropertyNames8_ES5.js]
|
||||
function f() {
|
||||
var t;
|
||||
var u;
|
||||
var v = {
|
||||
[t]: 0,
|
||||
[u]: 1
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts(9,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts(9,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts (4 errors) ====
|
||||
function f(s: string): string;
|
||||
function f(n: number): number;
|
||||
function f<T>(x: T): T;
|
||||
function f(x): any { }
|
||||
|
||||
var v = {
|
||||
[f("")]: 0,
|
||||
~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[f(0)]: 0,
|
||||
~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[f(true)]: 0
|
||||
~~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
//// [computedPropertyNames9_ES5.ts]
|
||||
function f(s: string): string;
|
||||
function f(n: number): number;
|
||||
function f<T>(x: T): T;
|
||||
function f(x): any { }
|
||||
|
||||
var v = {
|
||||
[f("")]: 0,
|
||||
[f(0)]: 0,
|
||||
[f(true)]: 0
|
||||
}
|
||||
|
||||
//// [computedPropertyNames9_ES5.js]
|
||||
function f(x) {
|
||||
}
|
||||
var v = {
|
||||
[f("")]: 0,
|
||||
[f(0)]: 0,
|
||||
[f(true)]: 0
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts(5,5): error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'.
|
||||
Index signatures are incompatible.
|
||||
Type 'string | number' is not assignable to type 'boolean'.
|
||||
Type 'string' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts (3 errors) ====
|
||||
interface I {
|
||||
[s: number]: boolean;
|
||||
}
|
||||
|
||||
var o: I = {
|
||||
~
|
||||
!!! error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'.
|
||||
!!! error TS2322: Index signatures are incompatible.
|
||||
!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'boolean'.
|
||||
[+"foo"]: "",
|
||||
~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
[+"bar"]: 0
|
||||
~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
//// [computedPropertyNamesContextualType10_ES5.ts]
|
||||
interface I {
|
||||
[s: number]: boolean;
|
||||
}
|
||||
|
||||
var o: I = {
|
||||
[+"foo"]: "",
|
||||
[+"bar"]: 0
|
||||
}
|
||||
|
||||
//// [computedPropertyNamesContextualType10_ES5.js]
|
||||
var o = {
|
||||
[+"foo"]: "",
|
||||
[+"bar"]: 0
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts (2 errors) ====
|
||||
interface I {
|
||||
[s: string]: (x: string) => number;
|
||||
[s: number]: (x: any) => number; // Doesn't get hit
|
||||
}
|
||||
|
||||
var o: I = {
|
||||
["" + 0](y) { return y.length; },
|
||||
~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
["" + 1]: y => y.length
|
||||
~~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
//// [computedPropertyNamesContextualType1_ES5.ts]
|
||||
interface I {
|
||||
[s: string]: (x: string) => number;
|
||||
[s: number]: (x: any) => number; // Doesn't get hit
|
||||
}
|
||||
|
||||
var o: I = {
|
||||
["" + 0](y) { return y.length; },
|
||||
["" + 1]: y => y.length
|
||||
}
|
||||
|
||||
//// [computedPropertyNamesContextualType1_ES5.js]
|
||||
var o = {
|
||||
["" + 0]: function (y) {
|
||||
return y.length;
|
||||
},
|
||||
["" + 1]: function (y) { return y.length; }
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user