Skip to content

Typedoc not honoring compilerOptions: paths? #2390

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
michaeltford opened this issue Sep 6, 2023 · 3 comments
Closed

Typedoc not honoring compilerOptions: paths? #2390

michaeltford opened this issue Sep 6, 2023 · 3 comments
Labels
no bug This is expected behavior

Comments

@michaeltford
Copy link

I have a mono repo with a tsconfig.json that contains paths

 "paths": {
      "@sheetxl/common/*": ["packages/common/src/*"],
      "@sheetxl/models/*": ["packages/models/src/*"],
}

With the follow typedocs.json

{
  "entryPoints": ["packages/*/src/index.ts"],
  "name": "SheetXL"
}

The docs are almost working but I would expect it to generate links that
follow @sheetxl/common (or even just common) instead of common_src.

see
https://api.sheetxl.com/modules/common_src.html

Is there a workaround where I can redefine or alias these within typedocs?

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Sep 7, 2023

You're probably after the @module tag, which can be used to rename an entry point - https://typedoc.org/tags/module/

This is working as designed:

  1. The file path is always a valid method of referring to the file.
  2. Multiple paths entries may map to the same file, so typedoc would have to arbitrarily choose one in those cases.
  3. Paths are terrible hacky things that don't represent how things work in any (non-bundled) runtime and should be avoided in favor of referencing projects as dependencies. Even npm today will symlink projects within node_modules if set up as a monorepo

@Gerrit0 Gerrit0 added the no bug This is expected behavior label Sep 7, 2023
@michaeltford
Copy link
Author

michaeltford commented Sep 7, 2023

Thanks @Gerrit0 for the quick response.

#3. I agree paths do seem very hacky but I wasn't able to get visual studio code to work without them. I will review trying to get rid of the path attribute again.

#2. I am not sure this is correct. typescript will also fail if there is more than one alias to the same path or it too would have to arbitrarily pick. (I think).

#1. Because of #3 the paths are only valid before bundle but not actually valid after bundle because typescript alters based on the paths attribute. (the /src path partial is removed.).

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Sep 8, 2023

The case I'm describing is this:

 "paths": {
      "@sheetxl/common/*": ["packages/common/src/*"],
      "@sheetxl/also-common/*": ["packages/common/src/*"],
}

This is completely fine for paths, but means that a path within there could be "mapped" back to multiple path aliases.

@Gerrit0 Gerrit0 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 24, 2023
@Gerrit0 Gerrit0 removed the bug label Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no bug This is expected behavior
Projects
None yet
Development

No branches or pull requests

2 participants