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

Typedoc produces incorrect documentation for equivalent type aliases #1454

Closed
handerss-spotfire opened this issue Jan 5, 2021 · 1 comment
Labels
bug Functionality does not match expectation

Comments

@handerss-spotfire
Copy link

handerss-spotfire commented Jan 5, 2021

Typedoc produces incorrect types in documentation when two type aliases are equivalent.

Example

type Foo = string | number;
type Bar = string | number;

declare function bar(): Bar;
declare function foo(): Foo;

This source produces documentation where the return type of the function foo is Bar. I expected the return type to be Foo.

This issue is new in 0.20.

Here's a repo with a reproducible example and resulting docs:

https://github.com/handerss-tibco/typedoc-alias-issue

https://handerss-tibco.github.io/typedoc-alias-issue/modules.html#foo

@handerss-spotfire handerss-spotfire added the bug Functionality does not match expectation label Jan 5, 2021
@Gerrit0 Gerrit0 closed this as completed in d528c69 Jan 6, 2021
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jan 6, 2021

Thanks for the reproduction!

Unfortunately... this is unfixable in the generic case. Fixing this specific case isn't too bad (0.20.13), but we rely on the type checker for getting the type of symbols... and the type checker doesn't preserve this information. Types may have a single aliasSymbol, but which type gets this symbol is determined by which alias is documented first... and once we have the type, we can't get back to the original declaration without a ridiculous amount of hackery.

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