Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

get-tsconfig normalizes include paths #73

Closed
1 of 2 tasks
inga-lovinde opened this issue May 5, 2024 · 4 comments
Closed
1 of 2 tasks

get-tsconfig normalizes include paths #73

inga-lovinde opened this issue May 5, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@inga-lovinde
Copy link
Contributor

inga-lovinde commented May 5, 2024

Problem

When include paths are defined in an extended config that is not in the same directory as sources, get-tsconfig normalizes these paths.

E.g. tsconfig.json extends configs/tsconfig.base.json which declares "include": ["../src/*"].

get-tsconfig produces include: ["src/*"].

Expected behavior

Technically, I would expect get-tsconfig to not normalize paths and to produce include: ["configs/../src/*"], as tsc does, since "TypeScript behavior is the source of truth so any behavior that strays away from it is a bug".

Minimal reproduction URL

https://stackblitz.com/edit/stackblitz-starters-ngtmsu

Version

v4.7.3

Node.js version

v18.18.0

Package manager

npm

Operating system

Linux

Contributions

  • I plan to open a pull request for this issue
    I plan to open a pull request adding a test that documents the current behavior, but I'm not sure fixing it is a good idea (not without incrementing the major version), because this can be a breaking change, and the issue is relatively minor and should not be a blocker for anyone.
  • I plan to make a financial contribution to this project
@inga-lovinde inga-lovinde added the bug Something isn't working label May 5, 2024
inga-lovinde added a commit to inga-lovinde/get-tsconfig that referenced this issue May 5, 2024
inga-lovinde added a commit to inga-lovinde/get-tsconfig that referenced this issue May 5, 2024
@privatenumber
Copy link
Owner

I'd be happy to accept a PR to update the docs.

Curious if there are any cases where the context of the unresolved path (e.g. configs/../src-a/*) would be useful. If there are, we can queue it up for the next major.

@inga-lovinde
Copy link
Contributor Author

Curious if there are any cases where the context of the unresolved path (e.g. configs/../src-a/*) would be useful.

TBH I suspect that this is more of an oversight in TypeScript, because they seem to normalize all other paths.

@privatenumber
Copy link
Owner

Hmm okay, maybe not worth addressing this one then.

Will close this out for now, but happy to re-open in the future if it turns out to be an issue.

I appreciate you being pedantic!

@privatenumber privatenumber closed this as not planned Won't fix, can't repro, duplicate, stale May 9, 2024
@inga-lovinde
Copy link
Contributor Author

inga-lovinde commented May 9, 2024

I just came across it when I was writing tests for #72 , so I thought that I'd better document it so that I would be able to link to this issue from https://github.com/privatenumber/get-tsconfig/pull/75/files#diff-8a065515830910425965e43cdba6e271a03c1fd3332958f6c50c97fe071b5bb0R246-R255 :)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants