Skip to content

Copy JSDoc from type when destructing arguments. #27601

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

Closed
4 tasks done
kitsonk opened this issue Oct 8, 2018 · 0 comments · Fixed by #46886
Closed
4 tasks done

Copy JSDoc from type when destructing arguments. #27601

kitsonk opened this issue Oct 8, 2018 · 0 comments · Fixed by #46886
Labels
Experience Enhancement Noncontroversial enhancements Help Wanted You can do this Suggestion An idea for TypeScript
Milestone

Comments

@kitsonk
Copy link
Contributor

kitsonk commented Oct 8, 2018

Search Terms

jsdoc argument destructuring

Suggestion

When specifying an interface which has JSDoc trivia, it should flow into any arguments that are destructured from that.

Refs #11859

Use Cases

When getting intellisense on destructured arguments, it is useful to be able to get the JSDoc of the specified interface. Currently, because TypeScript does not provide support for naming destructured arguments, obtaining the trivia seems like a more logical way anyways.

Examples

An example:

interface Options {
    /**
     * A description of foo
     */
    foo: string;
}

/**
 * A description of bar
 */
function bar({ foo }: Options) {
    foo; // Trivia could be: "A description of foo""
}

Currently, you get no JSDoc trivia.

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript / JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. new expression-level syntax)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Experience Enhancement Noncontroversial enhancements Help Wanted You can do this Suggestion An idea for TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants