-
Notifications
You must be signed in to change notification settings - Fork 12.8k
support @extends in jsdoc #18706
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
support @extends in jsdoc #18706
Conversation
src/compiler/utilities.ts
Outdated
@@ -4765,8 +4765,8 @@ namespace ts { | |||
return node.kind === SyntaxKind.JSDocComment; | |||
} | |||
|
|||
export function isJSDocAugmentsTag(node: Node): node is JSDocAugmentsTag { | |||
return node.kind === SyntaxKind.JSDocAugmentsTag; | |||
export function isJSDocAugmentsOrExtendsTag(node: Node): node is JSDocAugmentsOrExtendsTag { |
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.
this is part of the public API now, we should not break that.
src/compiler/parser.ts
Outdated
case SyntaxKind.JSDocAugmentsTag: | ||
return visitNode(cbNode, (<JSDocAugmentsTag>node).typeExpression); | ||
case SyntaxKind.JSDocAugmentsOrExtendsTag: | ||
case SyntaxKind.JSDocExtendsTag: |
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.
It seems like SyntaxKind.JSDocExtendsTag
is never assigned anywhere?
src/compiler/types.ts
Outdated
@@ -363,7 +363,8 @@ namespace ts { | |||
JSDocVariadicType, | |||
JSDocComment, | |||
JSDocTag, | |||
JSDocAugmentsTag, | |||
JSDocAugmentsOrExtendsTag, |
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 think we should keep JSDocAugmentsTag
and just let @extends
be a silent synonym for it in the parser. I don't think it's bad, for example, if the roundtrip emit converts @extends
to @augment
. And that's the worst side-effect I can think of.
@sandersn mentioned in #18854 (review) that we should have an error if both |
@@ -4247,6 +4247,12 @@ namespace ts { | |||
return find(tags, doc => doc.kind === kind); | |||
} | |||
|
|||
/** Gets all JSDoc tags of a specified kind, or undefined if not present. */ | |||
export function getAllJSDocTagsOfKind(node: Node, kind: SyntaxKind): ReadonlyArray<JSDocTag> | undefined { |
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.
remove 'All'
Fixes #18701