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 confuses any error types. #1828

Closed
dragomirtitian opened this issue Dec 23, 2021 · 3 comments
Closed

Typedoc confuses any error types. #1828

dragomirtitian opened this issue Dec 23, 2021 · 3 comments
Labels
bug Functionality does not match expectation

Comments

@dragomirtitian
Copy link
Collaborator

Search terms

type alias, rename

Expected Behavior

Typedoc should not confuse any error types.

Actual Behavior

Tyedoc ends up reporting types as being a rename of another type even though the types are wholly unrelated

Steps to reproduce the bug

//@ts-ignore
export type { T1 } from 'bad-module' // no types, no definitions

//@ts-ignore
export type { T2 } from 'bad-module-2' // no types, no definitions

//@ts-ignore
import { T3 } from 'bad-module-3' // no types, no definitions

export default T3;

This produces:

T2

Renames and re-exports T1

default

Renames and re-exports T1

Even though T2 and default are not in any way related to T1. For default it's even more confusing as T3 is not even mentioned, it gets resolved to T1

Environment

  • Typedoc version: 0.22.10
  • TypeScript version: 4.5
  • Node.js version: 15
  • OS: Windows 10
@dragomirtitian dragomirtitian added the bug Functionality does not match expectation label Dec 23, 2021
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jan 3, 2022

I'm really tempted to say that there's nothing to say that those aren't the same symbol. It wouldn't be difficult to always treat the error symbol as a new symbol, but then we might run into the opposite problem if anything references it (typeof T1 resulting in a "not exported" warning).

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jan 15, 2022

Having thought about this some more, we might be able to fix this by changing how symbol references are stored. Right now, TypeDoc relies on reference equality to determine if symbols are the same. If we change that to be based on paths + names (paths + names + line number to handle declaration merging?)...

This is something I've wanted to try for a while, since doing it should make it easier to fix #1606.

To do this, we'd need an update to the validateExports function, and it would probably also end up breaking typedoc-plugin-missing-exports... which is annoyingly popular.

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Aug 6, 2022

I did some more investigation on this, and... I don't think this is something I want to "fix". It is technically possible, but doing this means that a core assumption about how aliased symbols work would have to be changed, and would require a lot of rework with consequences I'm fairly certain would be detrimental in other cases (could probably hack the change in with 50loc, but I think it would break several internal plugins in very easy to miss ways).

An any is an any is an any...

@Gerrit0 Gerrit0 closed this as not planned Won't fix, can't repro, duplicate, stale Aug 6, 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
None yet
Development

No branches or pull requests

2 participants