-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix(typescript-estree): support override modifier for parameter property #3485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(typescript-estree): support override modifier for parameter property #3485
Conversation
Thanks for the PR, @sosukesuzuki! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day. |
@@ -386,6 +386,11 @@ tester.addFixturePatternConfig('typescript/basics', { | |||
* This is intentional; babel is not checking types | |||
*/ | |||
'catch-clause-with-invalid-annotation', | |||
/** | |||
* [BABEL ERRORED, BUT TS-ESTREE DID NOT] | |||
* SyntaxError: Unexpected token, expected "," |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
babel/parser cannot parse override modifier for parameter properties, I'll report and fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codecov Report
@@ Coverage Diff @@
## master #3485 +/- ##
=======================================
Coverage 92.63% 92.63%
=======================================
Files 325 325
Lines 11226 11227 +1
Branches 3163 3164 +1
=======================================
+ Hits 10399 10400 +1
Misses 367 367
Partials 460 460
Flags with carried forward coverage won't be shown. Click here to find out more.
|
I'm not sure about this. It currently is an explicit TS error, so I think that babel has it right. This should probably be a syntax error, and something we shouldn't support explicitly. I think this is another case where prettier could access the underlying TS ast to look for the existence of a bad modifier (until such time that we have support for syntax errors?) |
For example, in this case the override modifier of the parameter property is required. TypeScript Playground Link(The noImplicitOverride option is not set to true in this link, please set it to true manually.) |
OH! I see. When I built the feature, I used the playground to figure out what was supported. But that PR obviously makes it supported - and testing against 4.3.2 it does work without an error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - one suggestion:
could you please add a test for this case with JUST the override
as this emits as a parameter property:
class SpecializedComponent extends SomeComponent {
constructor(override param: string) {
super();
}
}
f6416ff
to
255c57f
Compare
255c57f
to
5213f4a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for this!
ref: prettier/prettier#11017
Support TS 4.3
override
modifier for parameter properties.TS Playground Link