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

Docs output depends on ordering of exports #1795

Closed
ejuda opened this issue Nov 16, 2021 · 1 comment
Closed

Docs output depends on ordering of exports #1795

ejuda opened this issue Nov 16, 2021 · 1 comment
Labels
bug Functionality does not match expectation

Comments

@ejuda
Copy link
Contributor

ejuda commented Nov 16, 2021

Search terms

default export, named export, reference

Expected Behavior

If the same thing (e.g. class, function) is exported in an entrypoint through both the default export and a named export, I'd expect the generated documentation to look the same regardless of which export has been defined first.

Preferably, if the same thing is exported in both the default and the named export, the default export should contain references to the named export, not the other way around.

Actual Behavior

TypeDoc will produce different documentation pages based on whether the default export is placed before or after the named export.

For the following code:

import { SomeClass } from "./someClass";

export default SomeClass;

export { SomeClass };

TypeDoc outputs:

image

while for this one:

import { SomeClass } from "./someClass";

export { SomeClass };

export default SomeClass;

it shows:

image

Steps to reproduce the bug

  1. Clone the reproduction repository.
  2. npm ci
  3. npm run docs
  4. This will generate two documentation directories:
    • docs-default-first, generated using defaultFirst.ts as the sole entrypoint,
    • docs-default-last, generated using defaultLast.ts as the sole entrypoint.

Environment

  • Typedoc version: 0.22.8
  • TypeScript version: 4.4.4
  • Node.js version: 14.15.4
  • OS: Windows 10
@ejuda ejuda added the bug Functionality does not match expectation label Nov 16, 2021
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Nov 22, 2021

I mean, the obvious solution is... stop using default exports.... seems reasonable to add a special case for this I guess.

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
None yet
Development

No branches or pull requests

2 participants