You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classFoo{privatebar=1;}letfoo=newFoo();foo.bar;// error as expectedfoo['bar'];// no error as expectedlet{bar}=foo;// error as expectedlet{'bar': bar2}=foo;// error (expected?)let{['bar']: bar3}=foo;// error (expected?)
Expected behavior:
#26328 states that accessing non-public properties via element access with string literal or late-bound name is intentionally allowed.
To be consistent that should also apply to destructuring with computed property name or quoted name.
TypeScript Version: 3.1.0-dev.20180808
Search Terms: private string access
Code
Expected behavior:
#26328 states that accessing non-public properties via element access with string literal or late-bound name is intentionally allowed.
To be consistent that should also apply to destructuring with computed property name or quoted name.
Actual behavior:
Errors as described by the inline comments.
Playground Link: https://agentcooper.github.io/typescript-play/#code/MYGwhgzhAEBiD29oG8BQ0PQA4CcCWAbmAC4Cm0ARmDtALzQCMA3KgL6oinHQBmid0AHakA7nEQAKAJQtUfeADoqOJtAD0a6KRw54NSFoAeWUsDIATOYgDaAcmW2Auqo1Ck23fpiljpi6g4uFGVWAXkXTQ89aAMfEzNSS05uZHtqWwAuSmoAJlD6cPVInWiJOL9EgH4pQJS7B0cs5QBmfN5ECK0SmjLfBPNqoA
Related Issues:
#26328
#26355
The text was updated successfully, but these errors were encountered: