-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
"The inferred type of X cannot be named without a reference to Y" (TS2742) #159
Comments
This might be an issue with symlinks and not only rules_ts? See microsoft/TypeScript#29808 (comment) |
Yup. Looks like this is a Typescript + symlinked node_modules structure issue and not specific to rules_js or Bazel. Issue in TypeScript repo is very active: microsoft/TypeScript#47663 @mrmeku has a repro outside of Bazel with pnpm, which also uses a symlinked node_modules structure like rules_js: https://github.com/mrmeku/portable_types_repro (from microsoft/TypeScript#47663 (comment)) |
One of the work-arounds in microsoft/TypeScript#47663 is to I was able to get this reproduction to work by doing that for the transitive closure with this change:
|
Until the underlying problem with Typescript and the symlinked node_modules structure is fixed, a work-around will be needed. |
node_modules
Seems like indeed it is a TypeScript bug. Described more in here:
microsoft/TypeScript#48212 (comment) I think the issue boils down to: transitive deps being resolved to outside the project? |
@gregmagolan I had closer look at the the minimum reproducible project today. I noticed the symlink structure is not exactly described in PNPM: Note, that under The project is under Note the |
I'm thinking if the symlink target is being kept in the project's subtree. It might fix the issue? |
That is an issue with Bazel itself wich controls how symlinks are layed out on disk. Historically the sandbox and runfiles trees created symlinks as absolute paths pointing out of the trees instead of relative within the trees. However, this problem is now resolved in Bazel 6 with some help from the community. Bazel 6 is currently at 6.0.0rc1. If you use the latest rules_js with Bazel 6.0.0rc1 and set the |
The bug still appears, although now inside the project subtree
|
@gregmagolan I'm still having this problem. And |
@gregmagolan could you provide more details for Is there any plan to get this fixed? |
@flolu Bazel 6 the feature is on by default so it is only with Bazel 5 that |
@gregmagolan I'm using Bazel 6:
You can reproduce the issue like this:
It throws:
|
The underlying with Typescript and the symlinked node_modules structure is still open microsoft/TypeScript#47663, although it looks like the discussion is still active and someone has proposed a set of patches. The issue has also been reported on the pnpm repo 4 days ago pnpm/pnpm#6089 since pnpm also uses a symlinked node_modules structure. For now a work-around is needed for this issue both with rules_js and pnpm. microsoft/TypeScript#47663 (comment) is one from the typescript issue and the reporter of the pnpm issue suggested one as well pnpm/pnpm#6089 (comment). |
@gregmagolan allright, thanks! |
Same issue here |
npm_link_package
labels indata
anddeps
attributes ints_project
is causing typescript to issue portability errors.Here is a reproduction and more info in the README:
https://github.com/tinganho/transitive-deps-bug
The text was updated successfully, but these errors were encountered: