188 lines
13 KiB
Plaintext
188 lines
13 KiB
Plaintext
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(2,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(2,50): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(3,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(3,50): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(4,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(4,51): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(5,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(5,49): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(6,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(6,51): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(7,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(7,50): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(18,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(22,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(26,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(30,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(35,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(35,62): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(36,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(36,69): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(37,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(37,59): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(38,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(38,60): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(42,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(43,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(50,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(55,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(60,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(64,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(67,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(68,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(76,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(77,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
|
|
|
|
==== tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts (34 errors) ====
|
|
// Get and set accessor with the same name
|
|
var sameName1a = { get 'a'() { return ''; }, set a(n) { var p = n; var p: string; } };
|
|
~~~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
var sameName2a = { get 0.0() { return ''; }, set 0(n) { var p = n; var p: string; } };
|
|
~~~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
var sameName3a = { get 0x20() { return ''; }, set 3.2e1(n) { var p = n; var p: string; } };
|
|
~~~~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
~~~~~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
var sameName4a = { get ''() { return ''; }, set ""(n) { var p = n; var p: string; } };
|
|
~~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
~~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
var sameName5a = { get '\t'() { return ''; }, set '\t'(n) { var p = n; var p: string; } };
|
|
~~~~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
~~~~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
var sameName6a = { get 'a'() { return ''; }, set a(n) { var p = n; var p: string; } };
|
|
~~~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
|
|
// PropertyName CallSignature{FunctionBody} is equivalent to PropertyName:function CallSignature{FunctionBody}
|
|
var callSig1 = { num(n: number) { return '' } };
|
|
var callSig1: { num: (n: number) => string; };
|
|
var callSig2 = { num: function (n: number) { return '' } };
|
|
var callSig2: { num: (n: number) => string; };
|
|
var callSig3 = { num: (n: number) => '' };
|
|
var callSig3: { num: (n: number) => string; };
|
|
|
|
// Get accessor only, type of the property is the annotated return type of the get accessor
|
|
var getter1 = { get x(): string { return undefined; } };
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
var getter1: { x: string; }
|
|
|
|
// Get accessor only, type of the property is the inferred return type of the get accessor
|
|
var getter2 = { get x() { return ''; } };
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
var getter2: { x: string; }
|
|
|
|
// Set accessor only, type of the property is the param type of the set accessor
|
|
var setter1 = { set x(n: number) { } };
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
var setter1: { x: number };
|
|
|
|
// Set accessor only, type of the property is Any for an unannotated set accessor
|
|
var setter2 = { set x(n) { } };
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
var setter2: { x: any };
|
|
|
|
var anyVar: any;
|
|
// Get and set accessor with matching type annotations
|
|
var sameType1 = { get x(): string { return undefined; }, set x(n: string) { } };
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
var sameType2 = { get x(): Array<number> { return undefined; }, set x(n: number[]) { } };
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
var sameType3 = { get x(): any { return undefined; }, set x(n: typeof anyVar) { } };
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
var sameType4 = { get x(): Date { return undefined; }, set x(n: Date) { } };
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
|
|
// Type of unannotated get accessor return type is the type annotation of the set accessor param
|
|
var setParamType1 = {
|
|
set n(x: (t: string) => void) { },
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
get n() { return (t) => {
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
var p: string;
|
|
var p = t;
|
|
}
|
|
}
|
|
};
|
|
var setParamType2 = {
|
|
get n() { return (t) => {
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
var p: string;
|
|
var p = t;
|
|
}
|
|
},
|
|
set n(x: (t: string) => void) { }
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
};
|
|
|
|
// Type of unannotated set accessor parameter is the return type annotation of the get accessor
|
|
var getParamType1 = {
|
|
set n(x) {
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
var y = x;
|
|
var y: string;
|
|
},
|
|
get n() { return ''; }
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
};
|
|
var getParamType2 = {
|
|
get n() { return ''; },
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
set n(x) {
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
var y = x;
|
|
var y: string;
|
|
}
|
|
};
|
|
|
|
// Type of unannotated accessors is the inferred return type of the get accessor
|
|
var getParamType3 = {
|
|
get n() { return ''; },
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
set n(x) {
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
var y = x;
|
|
var y: string;
|
|
}
|
|
};
|
|
|
|
|