-
Notifications
You must be signed in to change notification settings - Fork 205
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
TypeScript errors with moduleResolution nodenext #125
Comments
Coming from the ts-proto issue, a minimal reproduction is this
Works with this minimal tsconfig (
But breaks when
My guess is that @rjwalters has some dependencies in his ...ah, yes, here it is: "Finally, it’s worth noting that the only way to import ESM files from a CJS module is using dynamic import() calls. This can present challenges, but is the behavior in Node.js today." https://www.typescriptlang.org/docs/handbook/esm-node.html Fwiw I think the As-is, we've got two totally separate JS files (umd/esm), but are trying to reuse the types across the two, and TS's stricter Granted, @rjwalters can a) use |
Fwiw @rjwalters you might consider re-titling this issue (if you're allowed to as the reporter) to "TypeScript errors with moduleResolution nodenext" b/c I believe that is the core issue here. Granted, I think it does take a library using |
I met similar error before, and #124 fixed this for me. Not sure if it works for you |
Thanks @fs-eire ! I think that's exactly what we need. Thanks for creating the PR! |
The PR from @fs-eire works for me. |
Running into the same issue. Anyone has an idea as to why this is breaking only now? I've been running this code for month wihtout isues |
Typescript 5.2 has been released and you can no longer mix-and-match. I upgraded my repo to Typescript 5.2, Node 18 etc... and got the same error as @rjwalters The fix in #124 works but it probably not going to be a solution in production environments. Is there a path to fixing this that I could look at @dcodeIO or is this a pretty big change for the repo overall? |
Perhaps if the UMD typings are generated by build / excluded from Git, with that one line automatically amended, instead of manually duplicating these? |
Yes. The recommended way is to copy the file in npm prepack script. We don't need the duplicated index.d.ts file in the code base. We only need it in the NPM package |
I guess so. What would be the problems if this solution was put in place? I'd love to open a PR with some kind of fix, but I'm not sure of the problems that might happen if UMD typings are excluded? |
This also affects
Also, |
Is this getting resolved soon?? |
It affects Firebase Functions in some cases 💀 |
Workaround for dcodeIO/long.js#125
Workaround for dcodeIO/long.js#125
Workaround for dcodeIO/long.js#125
Workaround for dcodeIO/long.js#125
Workaround for dcodeIO/long.js#125
Workaround for dcodeIO/long.js#125
Workaround for dcodeIO/long.js#125
Workaround for dcodeIO/long.js#125
Any news on this issue? |
Somehow the codebase owner is unwilling to merge my PR #124. I am currently using the following workaround in my package.json to make typescript happy: "scripts": {
...
"preprepare": "node -e \"require('node:fs').copyFileSync('./node_modules/long/index.d.ts', './node_modules/long/umd/index.d.ts')\"",
... |
Thanks for providing this workaround. Hopefully the PR get's revised/merged, it's been months. |
I am having trouble upgrading a package that recently switched a dependency from long@^4 to long@^5:
I can suppress the error by skipping library checks in my tsconfig.json file but perhaps this points to a problem with UMD?
Here is my complete tsconfig for reference (with skipLibCheck=false):
stephenh/ts-proto#891
The text was updated successfully, but these errors were encountered: