-
Notifications
You must be signed in to change notification settings - Fork 508
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
Wrong typings generated when importing types from a package in a Rush monorepo (PNPM hard links) #967
Comments
Unfortunately, there is no way to disable |
The only workaround I found for now is
Although takes a bit more time. You can try to make a parallel run using I end-up with such scripts
Although will be nice to have it fixed :) As it definitely works improperly with PNPM. Also, disable |
@RIP21 What version of rush and pnpm are you using? |
"rushVersion": "5.38.0" |
@RIP21 I am using the same versions. I often get very strange type errors when building react component libs. Do you? |
Not really. If you, by accident, have, preserveSymlinks: true in tsconfig, make sure to disable it that will solve most of the problems. |
@RIP21 Hm. Just checked and I do not have that set. All the errors I get are of the form 'propertyName' does not exist on type 'IntrisicAttributes & ... etc` Here is an error message I get when using a I get a similar error using material-ui as well as several other react-component libs. |
@RIP21 I don't get those types of errors when building outside of rush/pnpm. I can spread in the props and it sometimes goes away but it's inconsistent |
So #953 reports part of the same error (the "no member" error) similarly in a Rush monorepo. It seemed like it might be due to the PNPM hard links that things break, but I haven't much of a clue why. I did a bit of debugging in that issue but really not sure where to go after those simpler leads turned up nothing. It's not clear why hard links would break things. TSDX uses rpts2 has had a number of bugs that have gone unfixed, so I've been eyeing swapping it out, but unfortunately TSDX has a history of bugs with the other 2 Rollup TS plugins as well (and rpts2 is the simpler of the bunch, so I've been able to contribute upstream several times as a result, which has not been as straightforward for the others) |
@agilgur5 what would you swap it out for? Esbuild? Some other thing? I think you are right about pnpm being problematic. |
For reference, I am fairly sure I fixed this upstream in ezolenko/rollup-plugin-typescript2#332, which fixed ezolenko/rollup-plugin-typescript2#330, which is a very similar upstream issue with To use that in your project, you can set your {
"pnpm": {
"overrides": {
"rollup-plugin-typescript2": "^0.32.0"
}
}
} And indeed, while the issue is different here, the root cause is the same as #953 so they are effectively duplicates.
No, I meant a different Rollup TypeScript plugin. They all have their own issues however and I was already contributing to rpt2 a bit in the past to fix issues from TSDX. I found rpt2 to be the simplest to contribute to by a wide margin, so I actually recently stepped up to help maintain it and have fixed a ton of issues in the past month, including the most long-standing ones like this one with |
@agilgur5 thank you for your work! I'm no longer working on this codebase to try, but still. Tsdx is my tool to go, so I'm happy it's probably fixed now. |
Current Behavior
I run
tsdx build --transpileOnly
From this source
It generates this d.ts:
Expected behavior
Should output (and this is what regular
tsc
withemitDeclarationsOnly
does):Additional context
It's Rush.js managed monorepo so it uses PNPM so hard links to link modules into
node_modules
.I'm using TS 4. A similar workaround mentioned here #926 (using PNPM fashioned resolutions) is applied.
If built without
--transpileOnly
fails withYour environment
The text was updated successfully, but these errors were encountered: