-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issueGood First IssueWell scoped, documented and has the green lightWell scoped, documented and has the green lightHelp WantedYou can do thisYou can do this
Milestone
Description
Bug Report
In classes, accessors (aka getters/setters) and generators can't be named with constructor. They're Syntax Errors defined in spec.
References:
- Early errors of class definitions. Please focus on the second point of the
MethodDefinitionsection. - Class accessors and generators are SpecialMethods.
🔎 Search Terms
constructor
getter
setter
accessor
generator
🕗 Version & Regression Information
Tested on 4.5.5, 4.6.2 and Nightly (4.7).
⏯ Playground Link
Playground link with relevant code
💻 Code
class C1 {
get constructor() {
return
}
set constructor(value) {}
}
class C2 {
*constructor() {}
}🙁 Actual behavior
No errors reported.
🙂 Expected behavior
TypeScript should report errors for misusing constructor as accessor name for Line 2 and Line 5, and report error for misusing constructor as generator for Line 9 in the example above.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issueGood First IssueWell scoped, documented and has the green lightWell scoped, documented and has the green lightHelp WantedYou can do thisYou can do this