Skip to content
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

Emit @overload comments on generated overloads in.d.ts #54846

Merged
merged 5 commits into from
Jul 6, 2023

Conversation

sandersn
Copy link
Member

@sandersn sandersn commented Jun 30, 2023

3 open questions:

  1. Is this the right way to do it? It's similar to the way addPropertyToElementList.
  2. Is it worthwhile to fix emit for multiple overloads in a single comment? That style only works without @template and with explicit @return for each signature, so I believe it's rare. I left it unfixed.
  3. Is it worthwhile to fix indentation? I copied some text manipulation code from getTextOfNodeFromSourceText, but I don't want to put my new code there without evidence that it's useful for more than just my case.

Fixes #53350

@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Jun 30, 2023
@Jack-Works
Copy link
Contributor

why this is needed? it already overloads with TS function signature

@sandersn
Copy link
Member Author

sandersn commented Jul 5, 2023

It's not needed for types. But the jsdoc includes text that should appear in signature help—and that text is specific to each overload, so each overload needs its own jsdoc.

@sandersn sandersn merged commit a05699c into microsoft:main Jul 6, 2023
@sandersn sandersn deleted the jsdoc-overload-comments branch July 6, 2023 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

.d.ts emit drops JSDoc when generating overload signatures from JSDoc @overload
4 participants