-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Merged
Merged
Make it a noImplicitAny error to fail to provide type arguments to a superclass via @augments #18778
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
429e1b4
Make it a noImplicitAny error to fail to provide type arguments to a …
564087a
Merge branch 'master' into jsExtendsImplicitAny
6e1488d
Don't recommend to add an @augments tag if it already exists
858c987
Merge branch 'master' into jsExtendsImplicitAny
6f584cb
Suggestions from code review
032ac21
Merge branch 'master' into jsExtendsImplicitAny
c2043b1
Shorten error message
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/b.js(1,17): error TS8022: Generic type 'A<T>' requires '1' type arguments; provide these with an '@augments' or '@extends' tag. | ||
|
||
|
||
==== /a.d.ts (0 errors) ==== | ||
declare class A<T> { x: T; } | ||
|
||
==== /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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Requires getting #18775 in first. |
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
=== /a.d.ts === | ||
declare class A<T> { x: T; } | ||
>A : Symbol(A, Decl(a.d.ts, 0, 0)) | ||
>T : Symbol(T, Decl(a.d.ts, 0, 16)) | ||
>x : Symbol(A.x, Decl(a.d.ts, 0, 20)) | ||
>T : Symbol(T, Decl(a.d.ts, 0, 16)) | ||
|
||
=== /b.js === | ||
class B extends A {} | ||
>B : Symbol(B, Decl(b.js, 0, 0)) | ||
>A : Symbol(A, Decl(a.d.ts, 0, 0)) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
=== /a.d.ts === | ||
declare class A<T> { x: T; } | ||
>A : A<T> | ||
>T : T | ||
>x : T | ||
>T : T | ||
|
||
=== /b.js === | ||
class B extends A {} | ||
>B : B | ||
>A : typeof A | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// @allowJs: true | ||
// @checkJs: true | ||
// @noEmit: true | ||
// @noImplicitAny: true | ||
|
||
// @Filename: /a.d.ts | ||
declare class A<T> { x: T; } | ||
|
||
// @Filename: /b.js | ||
class B extends A {} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.