This was we don't get noisy baselines just because a different phase of the compiler reported the diagnostic. This helps with Yui's refactoring work to move grammar checks into the type checker.
337 lines
No EOL
22 KiB
Text
337 lines
No EOL
22 KiB
Text
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(3,12): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(3,18): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(4,12): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(4,19): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(5,12): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(5,18): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(6,12): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(6,21): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(7,12): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(7,19): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(8,12): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(8,18): error TS2300: Duplicate identifier ''a''.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(9,12): error TS2300: Duplicate identifier ''a''.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(9,20): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(10,12): error TS2300: Duplicate identifier ''a''.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(10,20): error TS2300: Duplicate identifier '"a"'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(11,12): error TS2300: Duplicate identifier ''a''.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(11,20): error TS2300: Duplicate identifier ''a''.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(12,13): error TS2300: Duplicate identifier '"a"'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(12,21): error TS2300: Duplicate identifier ''a''.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(13,13): error TS2300: Duplicate identifier '1.0'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(13,21): error TS2300: Duplicate identifier ''1''.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(14,13): error TS2300: Duplicate identifier '0'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(14,19): error TS2300: Duplicate identifier '0'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(15,13): error TS2300: Duplicate identifier '0'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(15,19): error TS2300: Duplicate identifier '0'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(16,13): error TS2300: Duplicate identifier '0'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(16,19): error TS2300: Duplicate identifier '0x0'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(17,13): error TS2300: Duplicate identifier '0'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(17,19): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(17,19): error TS2300: Duplicate identifier '000'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(18,13): error TS2300: Duplicate identifier '"100"'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(18,23): error TS2300: Duplicate identifier '1e2'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(19,13): error TS2300: Duplicate identifier '0x20'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(19,22): error TS2300: Duplicate identifier '3.2e1'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(20,13): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(20,25): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(23,12): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(23,22): error TS1119: An object literal cannot have property and accessor with the same name.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(23,22): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(24,12): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(24,23): error TS1119: An object literal cannot have property and accessor with the same name.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(24,23): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(25,12): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(25,22): error TS1119: An object literal cannot have property and accessor with the same name.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(25,22): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(26,12): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(26,25): error TS1119: An object literal cannot have property and accessor with the same name.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(26,25): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(27,12): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(27,23): error TS1119: An object literal cannot have property and accessor with the same name.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(27,23): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(28,12): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(28,22): error TS1119: An object literal cannot have property and accessor with the same name.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(28,22): error TS2300: Duplicate identifier ''a''.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(29,12): error TS2300: Duplicate identifier ''a''.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(29,24): error TS1119: An object literal cannot have property and accessor with the same name.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(29,24): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(30,12): error TS2300: Duplicate identifier ''a''.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(30,24): error TS1119: An object literal cannot have property and accessor with the same name.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(30,24): error TS2300: Duplicate identifier '"a"'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(31,12): error TS2300: Duplicate identifier ''a''.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(31,24): error TS1119: An object literal cannot have property and accessor with the same name.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(31,24): error TS2300: Duplicate identifier ''a''.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(32,13): error TS2300: Duplicate identifier '"a"'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(32,25): error TS1119: An object literal cannot have property and accessor with the same name.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(32,25): error TS2300: Duplicate identifier ''a''.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(33,13): error TS2300: Duplicate identifier '1.0'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(33,25): error TS1119: An object literal cannot have property and accessor with the same name.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(33,25): error TS2300: Duplicate identifier ''1''.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(34,13): error TS2300: Duplicate identifier '0'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(34,23): error TS1119: An object literal cannot have property and accessor with the same name.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(34,23): error TS2300: Duplicate identifier '0'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(35,13): error TS2300: Duplicate identifier '0'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(35,23): error TS1119: An object literal cannot have property and accessor with the same name.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(35,23): error TS2300: Duplicate identifier '0'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(36,13): error TS2300: Duplicate identifier '0'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(36,23): error TS1119: An object literal cannot have property and accessor with the same name.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(36,23): error TS2300: Duplicate identifier '0x0'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(37,13): error TS2300: Duplicate identifier '0'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(37,23): error TS1119: An object literal cannot have property and accessor with the same name.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(37,23): error TS2300: Duplicate identifier '000'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(38,13): error TS2300: Duplicate identifier '"100"'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(38,27): error TS1119: An object literal cannot have property and accessor with the same name.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(38,27): error TS2300: Duplicate identifier '1e2'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(39,13): error TS2300: Duplicate identifier '0x20'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(39,26): error TS1119: An object literal cannot have property and accessor with the same name.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(39,26): error TS2300: Duplicate identifier '3.2e1'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(40,13): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(40,46): error TS1119: An object literal cannot have property and accessor with the same name.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(40,46): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(43,12): error TS2380: 'get' and 'set' accessor must have the same type.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(43,43): error TS2380: 'get' and 'set' accessor must have the same type.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(44,29): error TS2322: Type 'number' is not assignable to type 'string'.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(45,12): error TS2380: 'get' and 'set' accessor must have the same type.
|
|
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(45,51): error TS2380: 'get' and 'set' accessor must have the same type.
|
|
|
|
|
|
==== tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts (96 errors) ====
|
|
|
|
// Multiple properties with the same name
|
|
var e1 = { a: 0, a: 0 };
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
var e2 = { a: '', a: '' };
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
var e3 = { a: 0, a: '' };
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
var e4 = { a: true, a: false };
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
var e5 = { a: {}, a: {} };
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
var e6 = { a: 0, 'a': 0 };
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier ''a''.
|
|
var e7 = { 'a': 0, a: 0 };
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier ''a''.
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
var e8 = { 'a': 0, "a": 0 };
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier ''a''.
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier '"a"'.
|
|
var e9 = { 'a': 0, 'a': 0 };
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier ''a''.
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier ''a''.
|
|
var e10 = { "a": 0, 'a': 0 };
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier '"a"'.
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier ''a''.
|
|
var e11 = { 1.0: 0, '1': 0 };
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier '1.0'.
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier ''1''.
|
|
var e12 = { 0: 0, 0: 0 };
|
|
~
|
|
!!! error TS2300: Duplicate identifier '0'.
|
|
~
|
|
!!! error TS2300: Duplicate identifier '0'.
|
|
var e13 = { 0: 0, 0: 0 };
|
|
~
|
|
!!! error TS2300: Duplicate identifier '0'.
|
|
~
|
|
!!! error TS2300: Duplicate identifier '0'.
|
|
var e14 = { 0: 0, 0x0: 0 };
|
|
~
|
|
!!! error TS2300: Duplicate identifier '0'.
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier '0x0'.
|
|
var e14 = { 0: 0, 000: 0 };
|
|
~
|
|
!!! error TS2300: Duplicate identifier '0'.
|
|
~~~
|
|
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher.
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier '000'.
|
|
var e15 = { "100": 0, 1e2: 0 };
|
|
~~~~~
|
|
!!! error TS2300: Duplicate identifier '"100"'.
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier '1e2'.
|
|
var e16 = { 0x20: 0, 3.2e1: 0 };
|
|
~~~~
|
|
!!! error TS2300: Duplicate identifier '0x20'.
|
|
~~~~~
|
|
!!! error TS2300: Duplicate identifier '3.2e1'.
|
|
var e17 = { a: 0, b: 1, a: 0 };
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
|
|
// Accessor and property with the same name
|
|
var f1 = { a: 0, get a() { return 0; } };
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
~
|
|
!!! error TS1119: An object literal cannot have property and accessor with the same name.
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
var f2 = { a: '', get a() { return ''; } };
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
~
|
|
!!! error TS1119: An object literal cannot have property and accessor with the same name.
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
var f3 = { a: 0, get a() { return ''; } };
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
~
|
|
!!! error TS1119: An object literal cannot have property and accessor with the same name.
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
var f4 = { a: true, get a() { return false; } };
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
~
|
|
!!! error TS1119: An object literal cannot have property and accessor with the same name.
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
var f5 = { a: {}, get a() { return {}; } };
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
~
|
|
!!! error TS1119: An object literal cannot have property and accessor with the same name.
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
var f6 = { a: 0, get 'a'() { return 0; } };
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
~~~
|
|
!!! error TS1119: An object literal cannot have property and accessor with the same name.
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier ''a''.
|
|
var f7 = { 'a': 0, get a() { return 0; } };
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier ''a''.
|
|
~
|
|
!!! error TS1119: An object literal cannot have property and accessor with the same name.
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
var f8 = { 'a': 0, get "a"() { return 0; } };
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier ''a''.
|
|
~~~
|
|
!!! error TS1119: An object literal cannot have property and accessor with the same name.
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier '"a"'.
|
|
var f9 = { 'a': 0, get 'a'() { return 0; } };
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier ''a''.
|
|
~~~
|
|
!!! error TS1119: An object literal cannot have property and accessor with the same name.
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier ''a''.
|
|
var f10 = { "a": 0, get 'a'() { return 0; } };
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier '"a"'.
|
|
~~~
|
|
!!! error TS1119: An object literal cannot have property and accessor with the same name.
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier ''a''.
|
|
var f11 = { 1.0: 0, get '1'() { return 0; } };
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier '1.0'.
|
|
~~~
|
|
!!! error TS1119: An object literal cannot have property and accessor with the same name.
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier ''1''.
|
|
var f12 = { 0: 0, get 0() { return 0; } };
|
|
~
|
|
!!! error TS2300: Duplicate identifier '0'.
|
|
~
|
|
!!! error TS1119: An object literal cannot have property and accessor with the same name.
|
|
~
|
|
!!! error TS2300: Duplicate identifier '0'.
|
|
var f13 = { 0: 0, get 0() { return 0; } };
|
|
~
|
|
!!! error TS2300: Duplicate identifier '0'.
|
|
~
|
|
!!! error TS1119: An object literal cannot have property and accessor with the same name.
|
|
~
|
|
!!! error TS2300: Duplicate identifier '0'.
|
|
var f14 = { 0: 0, get 0x0() { return 0; } };
|
|
~
|
|
!!! error TS2300: Duplicate identifier '0'.
|
|
~~~
|
|
!!! error TS1119: An object literal cannot have property and accessor with the same name.
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier '0x0'.
|
|
var f14 = { 0: 0, get 000() { return 0; } };
|
|
~
|
|
!!! error TS2300: Duplicate identifier '0'.
|
|
~~~
|
|
!!! error TS1119: An object literal cannot have property and accessor with the same name.
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier '000'.
|
|
var f15 = { "100": 0, get 1e2() { return 0; } };
|
|
~~~~~
|
|
!!! error TS2300: Duplicate identifier '"100"'.
|
|
~~~
|
|
!!! error TS1119: An object literal cannot have property and accessor with the same name.
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier '1e2'.
|
|
var f16 = { 0x20: 0, get 3.2e1() { return 0; } };
|
|
~~~~
|
|
!!! error TS2300: Duplicate identifier '0x20'.
|
|
~~~~~
|
|
!!! error TS1119: An object literal cannot have property and accessor with the same name.
|
|
~~~~~
|
|
!!! error TS2300: Duplicate identifier '3.2e1'.
|
|
var f17 = { a: 0, get b() { return 1; }, get a() { return 0; } };
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
~
|
|
!!! error TS1119: An object literal cannot have property and accessor with the same name.
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
|
|
// Get and set accessor with mismatched type annotations
|
|
var g1 = { get a(): number { return 4; }, set a(n: string) { } };
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2380: 'get' and 'set' accessor must have the same type.
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2380: 'get' and 'set' accessor must have the same type.
|
|
var g2 = { get a() { return 4; }, set a(n: string) { } };
|
|
~
|
|
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
|
var g3 = { get a(): number { return undefined; }, set a(n: string) { } };
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2380: 'get' and 'set' accessor must have the same type.
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2380: 'get' and 'set' accessor must have the same type.
|
|
|