TypeScript Version: 3.1.0-dev.20180808
Search Terms: private destructuring
Code
classFoo{privatebar=1;}letfoo=newFoo();letbar: number;({bar}=foo);// no error({bar: bar}=foo);// no errorExpected behavior:
Error on both destructuring assignments.
Since element access on private properties is allowed (#26328), how would you expect the following to behave?
({'bar': bar}=foo);({['bar']: bar}=foo);Actual behavior:
No error
Playground Link:https://agentcooper.github.io/typescript-play/#code/MYGwhgzhAEBiD29oG8BQ0PQA4CcCWAbmAC4Cm0ARmDtALzQCMA3KgL6oinHQBmid0AHakA7nEQAKAJQsOXStQBcQgK4BbCqRwsJyKjlYC+8GdAD0ZoUi054OVLv3L9h+sdMWr0G3aA
Related Issues:#26328
TypeScript Version: 3.1.0-dev.20180808
Search Terms: private destructuring
Code
Expected behavior:
Error on both destructuring assignments.
Since element access on private properties is allowed (#26328), how would you expect the following to behave?
Actual behavior:
No error
Playground Link:https://agentcooper.github.io/typescript-play/#code/MYGwhgzhAEBiD29oG8BQ0PQA4CcCWAbmAC4Cm0ARmDtALzQCMA3KgL6oinHQBmid0AHakA7nEQAKAJQsOXStQBcQgK4BbCqRwsJyKjlYC+8GdAD0ZoUi054OVLv3L9h+sdMWr0G3aA
Related Issues:#26328