-
-
Notifications
You must be signed in to change notification settings - Fork 957
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
Got 12.1.0 x Typescript 4.7.2 x Node 16.15 transpilation fails with moduleResolution=Node16 #2051
Comments
Apparently we need to set |
Same, a little bit confused here. I cannot get this package to compile with TypeScript after the switch to ESM. Setting I feel like I'm missing something, does anyone have a barebones repo with TypeScript working?
|
To fix this, we need to upgrade AVA to v4 and then upgrade |
I'm currently giving it a try, and upgrading @sindresorhus/tsconfig to 3.0.1 breaks a lot of type-checking, notably with default imports, e.g Switching it for |
I really feel like this issue should have a much higher priority. Almost all sindresorhus packages have been promoting ESM only for a long time, and now that TS finally have proper support, this issue alone prevents me from finally migrating a big TypeScript project to ESM. Really hope someone picks this up soon, i will happily donate a cup of coffee to anyone moving on with this issue 😄 ❤️ |
We hear you @Baune8D ❤️ Unfortunately there's just only me and @sindresorhus. I'm quite busy with full-time work, I'll try to find time later this week to push this forward, but no promises. We encourage more people to make contributions ❤️ |
So after upgrading
=> Same issue for |
Finally decided to move to ESM and now being blocked by this issue unfortunately. Hoping for the swift success of #2109. |
Someone will have to open a pull request on |
// @szmarczak ^ |
I have opened PRs for both |
I've released |
Now that #2129 is closed, this is another issue that blocks
Frankly, last few releases from @sindresorhus (not only Got) been a sick joke introducing more problems to people that chose to follow his advises and use ESM. |
I temporarily solved this issue by removing |
The only blocking issue left for turning on strict mode here is https://github.com/szmarczak/cacheable-lookup having incorrect types. It uses default export without being ESM. I have asked @szmarczak if he can resolve this. |
I appreciate the push forward, but mainline releases really should be stable. The ESM requirement should have remained on a pre-release line until dependency issues were resolved. Yes, 11 is a fallback that most people use but new features all target 12. |
For what it’s worth: I updated Got from 12.4.1 to 12.5.0, ran into this issue, and found this thread. For the time being, I downgraded back to 12.4.1 and everything is back to a working state. Let me take the opportunity to thank y’all involved in Got and its dependencies! You’re the best! I really appreciate your attitude of moving things forward (ESM, and that sort of thing). Even when I get a paper cut from the bleeding edge, it’s always easy to backtrack a little 😁 Let me know if you want more information about my specific scenario or if I can help test something! |
@sindresorhus: Thanks for the update! I updated to 12.5.1 but I’m still getting errors of the following form:
Naturally, my
So now I don’t know what’s the right way forward: Possibility 1: I should continue with Possibility 2: I should switch to By the way, I’m fine either way. It could just like the RequireJS → ESM transition in which it takes a bit of time & work, but everyone’s better off in the end 😁 I just need a bit guidance on what to do next… Thanks again 👏 |
I would go with Alternatively, you could maybe set |
Sounds good. Thanks for the information 😁 |
Coming back here to report success: I changed Thank you again for the help! |
Fixes error "'resolution-mode' assertions are only supported when `moduleResolution` is `node16` or `nodenext`" with `got`. Details: <sindresorhus/got#2051> Also enable library checks for TypeScript validation now that typings are improved. Native ESM support details: <https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/#esm-nodejs> Requires using `.js` extensions for relative imports. `got` is also now ESM-only -> fix import path. Something's broken with `jwt-decode`'s exports, so using `.default` is required (ref: <auth0/jwt-decode#103> and <auth0/jwt-decode#130>).
Describe the bug
Actual behavior
Requiring got and transpiling with Typescript 4.7 raises transpilation errors
Code to reproduce
package.json
tsconfig.json
"moduleResolution": "Node16" is apparently required for Typescript 4.7 support of the
exports
field in package.jsonChecklist
The text was updated successfully, but these errors were encountered: