[ts] Support override modifiers for parameter properties#13428
Conversation
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/46782/ |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 8f7c78c:
|
|
Do we enforce modifier order in constructor args too? class Foo extends Bar {
constructor(override private readonly foo: string) {
}
}And can you test this also on a regular class method, because the test should fail in that case as for |
| if (allowModifiers !== undefined) { | ||
| accessibility = this.parseAccessModifier(); | ||
| override = !!this.tsParseModifier(["override"]); | ||
| readonly = !!this.tsParseModifier(["readonly"]); |
This comment was marked as duplicate.
This comment was marked as duplicate.
Sorry, something went wrong.
| accessibility = this.parseAccessModifier(); | ||
| override = !!this.tsParseModifier(["override"]); | ||
| readonly = !!this.tsParseModifier(["readonly"]); | ||
| if (allowModifiers === false && (accessibility || readonly)) { |
There was a problem hiding this comment.
should we also check override here?
| const modified = {}; | ||
| this.tsParseModifiers(modified, [ | ||
| "public", | ||
| "private", | ||
| "protected", | ||
| "override", | ||
| "readonly", | ||
| ]); | ||
| accessibility = modified.accessibility; | ||
| override = modified.override; | ||
| readonly = modified.readonly; |
There was a problem hiding this comment.
I used tsParseModifiers on an empty object to reuse the logic to enforce the order. What do you think?
Uh oh!
There was an error while loading. Please reload this page.