Skip to content

strictNullChecks doesn't work with empty destructuring assignment #20873

Closed

Description

TypeScript Version: 2.7.0-dev.20171223

Code

const [] = null;

Expected behavior:

error

Actual behavior:

pass

Activity

  1. DanielRosenwasser commented on Dec 23, 2017

    @DanielRosenwasser
    Member

    We should reuse the Object is possibly ____ messages and check for the RHS of any destructuring assignment. The following cases should error:

    let { } = null;
    ({} = null);
    
    let { } = undefined;
    ({} = undefined);
    
    let { } = Math.random() ? {} : null;
    ({} = Math.random() ? {} : null);
    
    let { } = Math.random() ? {} : undefined;
    ({} = Math.random() ? {} : undefined);
    
    let { } = Math.random() ? null : undefined;
    ({} = Math.random() ? null : undefined);
  2. jack-williams commented on Dec 29, 2017

    @jack-williams
    Collaborator

    Is anyone working on this? I'd be interested in having a go, but I don't want to impose if anyone is working on it already, or planning to.

    Edit: See #21110

  3. added this to the milestone on Jan 4, 2018
  4. added a commit that references this issue on Jan 18, 2018
    39fee67
  5. modified the milestones: , TypeScript 2.7.1 on Jan 18, 2018
  6. added
    Fixed
    on Jan 18, 2018
  7. locked and limited conversation to collaborators on Jul 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugFixed

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions