-
Notifications
You must be signed in to change notification settings - Fork 522
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
Incorrect type import in generated d.ts in monorepo #2333
Comments
rootDirs
setting
Update: the workaround I ended up using is to move TypeScript's declaration file emitter calls |
Thanks for digging into the root cause here to understand the problem, @pyrocat101 ! Can you suggest what change we could make in rules_nodejs that would have helped you get this right? |
I like this idea! It would certainly help me catch the misconfiguration sooner.
This is the issue only when the tsconfig.json is placed at the workspace root, where the
That being said, have you considered providing d.ts files of other TypeScript targets in the execroot (in the same location as if they are the source files) for |
want to send a PR to update that note? It's an interesting idea to patch the .d.ts files into the execroot as if they were laid out in the source tree. In fact we do this already if there's a "LinkablePackageInfo" (e.g. |
This issue has been automatically marked as stale because it has not had any activity for 90 days. It will be closed if no further activity occurs in two weeks. Collaborators can add a "cleanup" or "need: discussion" label to keep it open indefinitely. Thanks for your contributions to rules_nodejs! |
This issue was automatically closed because it went two weeks without a reply since it was labeled "Can Close?" |
🐞 bug report
Affected Rule
The issue is caused by the rule: ts_projectIs this a regression?
No.
Description
This issue is similar to #2298.
I have been trying to set up Bazel with
ts_project
in a large monorepo. The monorepo contains many packages that were previously type checked using TypeScript project references:Non-relative imports are resolved to be relative to repo root using TypeScript
baseUrl
setting. We don't allow relative path import so that there is only one canonical import specifier for a file:When using Bazel, I modified the tsconfig.json to use the following setting:
Now if we have two package
foo
andbar
. Ifbar
depends on a type exported byfoo
, we have seen the emittedbar/index.d.ts
containing invalid import path like this.🔬 Minimal Reproduction
See https://github.com/pyrocat101/ts-bazel-repro
Try to build target
//bar:types
and checkbazel-bin/bar/index.d.ts
.🌍 Your Environment
Operating System:
Output of
bazel version
:Rules_nodejs version:
(Please check that you have matching versions between WORKSPACE file and
@bazel/*
npm packages.)Anything else relevant?
The text was updated successfully, but these errors were encountered: