-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Don't inherit jsdoc tags from overloaded signatures #43165
Conversation
Previously, when getting jsdoc for signatures, the services layer would get the jsdoc tags for the base symbol of a signature if it was present. This is fine except when the base was overloaded. In that case, the multiple signatures of the overload would all contribute jsdoc, which is not correct. A more correct fix would be to resolve overloads to the base, but the compiler doesn't have this capability and adding it or jury-rigging it seems like it would be complex, inappropriate for a fix to ship in a patch version. Co-authored-by: Orta Therox <[email protected]>
"kind": "punctuation" | ||
} | ||
], | ||
"documentation": [] |
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 line is the assertion we're interested in
tags = [...inheritedTags, ...tags]; | ||
} | ||
}); | ||
function getJsDocTagsOfSignature(declaration: Declaration, checker: TypeChecker): JSDocTagInfo[] { |
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 function is only called here, and is short, so I wanted to inline it, but it was non-trivial so I skipped it to keep the diff smaller. I couldn't help myself simplifying out the unused declarations: Declaration[]
to declaration: Declaration
, though.
Review reads better with whitespace ignored |
@a-tarasyuk you might be interested in this. I'm curious whether you have any clever ideas for resolving a call to its base interface. |
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.
Looks like it only changes the behavior we want 👍🏻
Is there a plan to release a version of 4.2 with this fix in it? Or just role this into 4.3? Right now I'm attempting to upgrade our repo to webpack 5 -> which means I need ts 4.2 (for the lib changes) and that is causing the |
Because the TC39 meetings are currently happening it's a little chaotic for another day or two on our side, but I'd say this is very likely heading towards a 4.2 patch. |
Previously, when getting jsdoc for signatures, the services layer would get the jsdoc tags for the base symbol of a signature if it was present. This is fine except when the base was overloaded. In that case, the multiple signatures of the overload would all contribute jsdoc, which is not correct. A more correct fix would be to resolve overloads to the base, but the compiler doesn't have this capability and adding it or jury-rigging it seems like it would be complex, inappropriate for a fix to ship in a patch version. Co-authored-by: Orta Therox <[email protected]> Co-authored-by: Orta Therox <[email protected]>
* Don't inherit jsdoc tags from overloaded signatures (#43165) Previously, when getting jsdoc for signatures, the services layer would get the jsdoc tags for the base symbol of a signature if it was present. This is fine except when the base was overloaded. In that case, the multiple signatures of the overload would all contribute jsdoc, which is not correct. A more correct fix would be to resolve overloads to the base, but the compiler doesn't have this capability and adding it or jury-rigging it seems like it would be complex, inappropriate for a fix to ship in a patch version. Co-authored-by: Orta Therox <[email protected]> Co-authored-by: Orta Therox <[email protected]> * Update baseline Co-authored-by: Nathan Shively-Sanders <[email protected]>
Previously, when getting jsdoc for signatures, the services layer would get the jsdoc tags for the base symbol of a signature if it was
present. This is fine except when the base was overloaded. In that case, the multiple signatures of the overload would all contribute jsdoc, which is not correct.
A more correct fix would be to resolve overloads to the base, but the compiler doesn't have this capability and adding it or jury-rigging it seems like it would be complex, inappropriate for a fix to ship in a patch version.
Co-authored-by: Orta Therox [email protected]
Fixes #43053