-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Make it a noImplicitAny error to fail to provide type arguments to a superclass via @augments #18778
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
Conversation
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.
How does this behave when the augments tag is itself missing type arguments?
src/compiler/diagnosticMessages.json
Outdated
@@ -3511,6 +3511,14 @@ | |||
"category": "Error", | |||
"code": 8021 | |||
}, | |||
"Generic type '{0}' requires '{1}' type arguments; provide these with an '@augments' or '@extends' tag.": { |
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.
I'd choose one of @augments
or @extends
for the error, preferably the one that is in the source if it is already there.
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.
There probably won't be one already there; we might just recommend @extends
since that's the more intuitive name.
==== /b.js (1 errors) ==== | ||
class B extends A {} | ||
~ | ||
!!! error TS8022: Generic type 'A<T>' requires '1' type arguments; provide these with an '@augments' or '@extends' tag. |
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.
Can you add a test for
/** @augments A */
class B { }
There should be an error on A on the first line, I think.
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.
Requires getting #18775 in first.
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.
Approved after switching to the newer error wording, which also displays numTypeArguments
to the user.
src/compiler/diagnosticMessages.json
Outdated
"category": "Error", | ||
"code": 8025 | ||
}, | ||
"Generic type '{0}' requires between '{1}' and '{2}' type arguments; provide these with an '@extends' tag.": { |
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.
Fixes #17073
Diagnostic message mentions
@extends
in anticipation of #18706