mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
81 lines
4.0 KiB
Plaintext
81 lines
4.0 KiB
Plaintext
destructuringSameNames.ts(21,7): error TS2451: Cannot redeclare block-scoped variable 'foo1'.
|
|
destructuringSameNames.ts(21,13): error TS2451: Cannot redeclare block-scoped variable 'foo1'.
|
|
destructuringSameNames.ts(22,7): error TS2451: Cannot redeclare block-scoped variable 'foo2'.
|
|
destructuringSameNames.ts(22,19): error TS2451: Cannot redeclare block-scoped variable 'foo2'.
|
|
destructuringSameNames.ts(23,13): error TS2451: Cannot redeclare block-scoped variable 'foo3'.
|
|
destructuringSameNames.ts(23,19): error TS2451: Cannot redeclare block-scoped variable 'foo3'.
|
|
destructuringSameNames.ts(24,9): error TS2451: Cannot redeclare block-scoped variable 'foo4'.
|
|
destructuringSameNames.ts(24,15): error TS2451: Cannot redeclare block-scoped variable 'foo4'.
|
|
destructuringSameNames.ts(25,9): error TS2451: Cannot redeclare block-scoped variable 'foo5'.
|
|
destructuringSameNames.ts(25,21): error TS2451: Cannot redeclare block-scoped variable 'foo5'.
|
|
destructuringSameNames.ts(26,15): error TS2451: Cannot redeclare block-scoped variable 'foo6'.
|
|
destructuringSameNames.ts(26,21): error TS2451: Cannot redeclare block-scoped variable 'foo6'.
|
|
destructuringSameNames.ts(28,6): error TS2451: Cannot redeclare block-scoped variable 'blah1'.
|
|
destructuringSameNames.ts(28,13): error TS2451: Cannot redeclare block-scoped variable 'blah1'.
|
|
destructuringSameNames.ts(29,8): error TS2451: Cannot redeclare block-scoped variable 'blah2'.
|
|
destructuringSameNames.ts(29,15): error TS2451: Cannot redeclare block-scoped variable 'blah2'.
|
|
|
|
|
|
==== destructuringSameNames.ts (16 errors) ====
|
|
// Valid cases
|
|
|
|
let { foo, foo: bar } = { foo: 1 };
|
|
({ foo, foo } = { foo: 2 });
|
|
({ foo, foo: bar } = { foo: 3 });
|
|
({ foo: bar, foo } = { foo: 4 });
|
|
({ foo, bar: foo } = { foo: 3, bar: 33 });
|
|
({ bar: foo, foo } = { foo: 4, bar: 44 });
|
|
({ foo: bar, foo: bar } = { foo: 5 });
|
|
({ foo: bar, bar: foo } = { foo: 6, bar: 66 });
|
|
({ foo: bar, foo: bar } = { foo: 7 });
|
|
|
|
[foo, foo] = [111, 1111];
|
|
[foo, foo] = [222, 2222];
|
|
[bar, foo, foo] = [333, 3333, 33333];
|
|
[foo, bar, foo] = [333, 3333, 33333];
|
|
[foo, foo, bar] = [444, 4444, 44444];
|
|
|
|
// Error cases
|
|
|
|
let { foo1, foo1 } = { foo1: 10 };
|
|
~~~~
|
|
!!! error TS2451: Cannot redeclare block-scoped variable 'foo1'.
|
|
~~~~
|
|
!!! error TS2451: Cannot redeclare block-scoped variable 'foo1'.
|
|
let { foo2, bar2: foo2 } = { foo2: 20, bar2: 220 };
|
|
~~~~
|
|
!!! error TS2451: Cannot redeclare block-scoped variable 'foo2'.
|
|
~~~~
|
|
!!! error TS2451: Cannot redeclare block-scoped variable 'foo2'.
|
|
let { bar3: foo3, foo3 } = { foo3: 30, bar3: 330 };
|
|
~~~~
|
|
!!! error TS2451: Cannot redeclare block-scoped variable 'foo3'.
|
|
~~~~
|
|
!!! error TS2451: Cannot redeclare block-scoped variable 'foo3'.
|
|
const { foo4, foo4 } = { foo4: 40 };
|
|
~~~~
|
|
!!! error TS2451: Cannot redeclare block-scoped variable 'foo4'.
|
|
~~~~
|
|
!!! error TS2451: Cannot redeclare block-scoped variable 'foo4'.
|
|
const { foo5, bar5: foo5 } = { foo5: 50, bar5: 550 };
|
|
~~~~
|
|
!!! error TS2451: Cannot redeclare block-scoped variable 'foo5'.
|
|
~~~~
|
|
!!! error TS2451: Cannot redeclare block-scoped variable 'foo5'.
|
|
const { bar6: foo6, foo6 } = { foo6: 60, bar6: 660 };
|
|
~~~~
|
|
!!! error TS2451: Cannot redeclare block-scoped variable 'foo6'.
|
|
~~~~
|
|
!!! error TS2451: Cannot redeclare block-scoped variable 'foo6'.
|
|
|
|
let [blah1, blah1] = [111, 222];
|
|
~~~~~
|
|
!!! error TS2451: Cannot redeclare block-scoped variable 'blah1'.
|
|
~~~~~
|
|
!!! error TS2451: Cannot redeclare block-scoped variable 'blah1'.
|
|
const [blah2, blah2] = [333, 444];
|
|
~~~~~
|
|
!!! error TS2451: Cannot redeclare block-scoped variable 'blah2'.
|
|
~~~~~
|
|
!!! error TS2451: Cannot redeclare block-scoped variable 'blah2'.
|
|
|