Skip to content

Lift destructuring restriction #11

@ghost

Description

destructuring is not allowed (even if only a single variable is "pulled out"), as there's potential confusion as to what's actually being checked (the value vs. whether the desired key/index was present in the object/array)

While it might be confusing, it's also the reality of how JavaScript was designed.

const error = new TypeError("Some error");
let stack, message, name;

console.error(
    { stack, message, name } = error
);

This will log the error object on the rhs to the console, regardless of whether or not one considers it confusing.
Is the argument that it could potentially be confusing, so strong that it would be denied here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions