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

Variables in separate export statement get doc of export statement, not doc of declaration #1901

Closed
Josh-Cena opened this issue Mar 30, 2022 · 6 comments
Labels
bug Functionality does not match expectation
Milestone

Comments

@Josh-Cena
Copy link

Search terms

export variable

Steps to reproduce the bug

// constants.d.ts

/** A constant */
declare const constant1 = 1;
/** Another constant */
declare const constant2 = true;
/**
 * bar
 * @param a foo
 */
declare function foo(a: number): void;

/**
 * copyright
 */
export {
  constant1,
  constant2,
  foo,
};
yarn typedoc --entryPoints constants.d.ts

Generated doc:

image

See also: facebook/docusaurus#7060 and deploy preview for this bug in action.

Expected Behavior

The function foo correctly gets the doc of declaration. Variables should behave the same.

Actual Behavior

The variable constants get the doc of the export statement, which is a copyright header.

Environment

  • Typedoc version: 0.22.13
  • TypeScript version: 4.6.3
  • Node.js version: 17.5.0
  • OS: MacOS 11.6
@Josh-Cena Josh-Cena added the bug Functionality does not match expectation label Mar 30, 2022
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Mar 30, 2022

Duplicate of #1886, this is working as intended. You could toss a @module tag in the copyright comment, or make it a non-JSDoc comment which would prevent it from being associated with the export declaration

@Josh-Cena
Copy link
Author

I see, thanks!

@Josh-Cena
Copy link
Author

Is there a particular reason why doc for functions don't get overridden by the export statement comment though?

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Mar 30, 2022

That looks like an oversight + bug to me, didn't see it the first time I looked at it

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Apr 3, 2022

... and fixing it is really annoying. I'm tempted to instead make export comments only do a thing for modules/namespaces...

@Gerrit0 Gerrit0 added this to To do in TSDoc - v0.23 via automation Apr 9, 2022
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Apr 9, 2022

I'm tempted to instead make export comments only do a thing for modules/namespaces...

Going to do this as a part of 0.23's breaking changes.

@Gerrit0 Gerrit0 moved this from To do to In progress in TSDoc - v0.23 Apr 10, 2022
@Gerrit0 Gerrit0 moved this from In progress to Done in TSDoc - v0.23 Apr 10, 2022
@Gerrit0 Gerrit0 added this to the v0.23 milestone Apr 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality does not match expectation
Projects
No open projects
Development

No branches or pull requests

2 participants