Skip to content

Destructuring assignment doesn't check assignability #24634

@falsandtru

Description

@falsandtru

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptHelp WantedYou can do this

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions