Skip to content

Missing syntax error for destructuring with private names #35942

Description

TypeScript Version: 3.8.0-dev.20191228

Search Terms:

Code

class C{
    #prop = 1;
    method() {
        const { #prop/*1*/: prop } = this;
        ({ #prop/*2*/: this.#prop } = this);
    }
}

Expected behavior:

Error at /*1*/ and /*2*/ since this syntax is not (yet) allowed. tc39/proposal-class-fields#4

Thanks to Titian Cernicova-Dragomir (@dragomirtitian) for pointing this out.

Actual behavior:

No error.

Playground Link: https://www.typescriptlang.org/play/?ts=3.8.0-dev.20191228&ssl=7&ssc=2&pln=1&pc=1#code/MYGwhgzhAEDCDeAoaLoGIAOAnA9h6AvNAIwDcyqAtgKYAuAFjgCYAUAlNEqt9MDgHYRandNjwAuaGPwBfQtAYBLCOR6oW8UbgySlEAHSZt0OUT1tVqGYhlA

Related Issues: #35934 #35935 #35936

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: ParserThe parser didn't handle the syntax correctly

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions