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

Destructuring assignment doesn't check assignability #24634

Closed
falsandtru opened this issue Jun 3, 2018 · 2 comments · Fixed by #25263
Closed

Destructuring assignment doesn't check assignability #24634

falsandtru opened this issue Jun 3, 2018 · 2 comments · Fixed by #25263
Labels
Bug A bug in TypeScript Help Wanted You can do this
Milestone

Comments

@falsandtru
Copy link
Contributor

A value being destructed by [] must be iterable.
A value being destructed by {} must be non-nullable.

TypeScript Version: master

Search Terms:

Code

const [] = {}; // should be error
const {} = undefined; // error correctly
(([]) => 0)({}); // should be error
(({}) => 0)(undefined); // should be error

Expected behavior:

Actual behavior:

Playground Link:

Related Issues:

@mhegazy mhegazy added Bug A bug in TypeScript Help Wanted You can do this labels Jun 4, 2018
@mhegazy mhegazy added this to the Community milestone Jun 4, 2018
@Kingwl
Copy link
Contributor

Kingwl commented Jun 27, 2018

some case

function foo({}: undefined) {
    return 0
}
function bar([]: {}) {
    return 0
}

const { }: undefined = 1
const []: {} = {}

@Kingwl
Copy link
Contributor

Kingwl commented Jun 27, 2018

#20873

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Help Wanted You can do this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants