-
Notifications
You must be signed in to change notification settings - Fork 104
Ladle breaking TypeScript when moduleResolution: "NodeNext"
#267
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
Comments
Yes, we have the same problem (with node16 resolution). We just don't typecheck (yet) in our docs projects. I think a d.ts. file in the exports won't work because there are no separate .d.ts Files, only .ts files. This works because the files in Ladles lib directory are supposed to be processed by Vite/Esbuild all the time. I am not sure how this problem can be solved. I experimented a bit by putting a local tsconfig.json in the ladle folder in node_modules and set "moduleResolution": "node" there, but that didn't work. |
Yeah, Ladle needs to generate Fortunately it maybe isn't too hard to fix: add a |
@frehner : I think this will not be enough. Typescript never touches the imports, the Node16/NodeNext module resolution would still require the |
Maybe an easy solution would be to append |
I'm only talking about Ladle creating |
Can you test this out? That seems like a simple fix if it works. |
@tajo I have it working - but ONLY for external packages (tested using linking). However, because the types are only generated right before creating the npm package and aren't kept in source control, that means that other packages in the ladle monorepo can't find the types and fail the So I think you have a couple of options here:
Would it be helpful if I put up my changes so you could see them, even if it's not fully working yet? |
This is fine with me since we don't change the exported API that often anyway. As long as we have a CI test for it to make sure it's in sync.
This would mean flipping all the code (including node/CLI) into |
No, not necessarily. They could remain as-is, if you wanted to go this route. You would only have to process the Actually, now that I think about it more, we don't necessarily have to put them into git / VCS: Option 3, we could have the [edit] I don't think the |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
Ladle breaks Typescript type-checking (e.g.
tsc --noEmit
) when Typescript has the configmoduleResolution: "NodeNext"
, even whenskipLibCheck: true
Reproduction
https://stackblitz.com/edit/ladle-zq9ane?file=package.json
and run
The specific error that causes issues looks like the following, and note that it's looking in
node_modules
:Environment
More Context
From this TS issue (that apparently is "working as intended" for now), it seems that the error comes from the fact that Ladle's
package.json#types
field points to a.ts
file instead of a.d.ts
file.The text was updated successfully, but these errors were encountered: