Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dangerous array (tuple) destructuring #3777

Closed
minedeljkovic opened this issue Apr 20, 2017 · 2 comments
Closed

Dangerous array (tuple) destructuring #3777

minedeljkovic opened this issue Apr 20, 2017 · 2 comments

Comments

@minedeljkovic
Copy link

const [a, b] = {}
;(a.foo: string)

const [c, d] = () => {}
;(c.foo: string)

const [e, f] = []
;(e.foo: string)

Try

For comparison, all these cases are reported in TypeScript

Related #733 #1512 #2612

@minedeljkovic
Copy link
Author

@vkurchatkin what is 3rd case:

const [e, f] = []
;(e.foo: string)

duplicate of? I would like to follow that issue.

@vkurchatkin
Copy link
Contributor

I think it's by design actually:

const a = []; // Array<any>
(a[1]:string);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants