Skip to content

Give better message for rest parameter properties #8827

Description

@DanielRosenwasser

If I write the following code:

class C {
    constructor(private ...x) {
    }
}

then I get the error ',' expected..

Instead, I should get an error like A parameter property cannot be declared using a rest parameter.

As motivation, for the following

class C {
    constructor(private {x}) {
    }
}

we currently give the error A parameter property may not be a binding pattern.

Additionally, in fixing this, the two should be consistent. Preferably, the new error for the latter should be A parameter property may not be declared using a binding pattern.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: Error MessagesThe issue relates to error messagingFixedA PR has been merged for this issueGood First IssueWell scoped, documented and has the green lightHelp 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