Skip to content

tsconfig paths causes module resolution to succeed and fail in the same build #50391

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
kwasimensah opened this issue Aug 21, 2022 · 1 comment

Comments

@kwasimensah
Copy link

Bug Report

I'm working in a monorepo and was trying to use tsconfig paths instead of npm link to have various packages depend on each other and it isn't working. Based on @andrewbranch's comment in #49160 (comment)

all any package author has to do is put their .d.ts files in the same directories as their .js files,

it seems like this should work and I'm getting a confusing error from --traceResolution about it not working.

🔎 Search Terms

baseUrl paths resolution

🕗 Version & Regression Information

Version 4.7.4
Version 4.6.4

Also happens with typescript@next

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about module resolution

💻 Code

Given https://github.com/kwasimensah/ubiquitous-winner

Run

npx tsc -b --traceResolution b/tsconfig.json

🙁 Actual behavior

You will see both

======== Module name 'a' was successfully resolved
b/b.ts:1:21 - error TS2307: Cannot find module 'a' or its corresponding type declarations.

1 import { foo } from "a";
                      ~~~

🙂 Expected behavior

The command is successful and a's types are found. Or a clearer error that doesn't make it seem like module resolution was successful

@kwasimensah
Copy link
Author

ugh, noResolve in my tsconfig.json was causing the error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant