-
Notifications
You must be signed in to change notification settings - Fork 26
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
edit-package-json incompatibility with typescript 4.7.3, moduleResolution Node16 #47
Comments
Thank you for reporting that and sorry for the bug. I'll patch it this weekend. |
Interesting, it's happening on other libs too: https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/#comment-328 |
I recreated the setup with the aforementioned
TS transpiles fine using Please choose and fork one of the above and adapt to your breaking code, trimming it down until you are able to distill the minimal proof case. Also, with regards to the type definitions being in the different folder — I'll close this issue now but when you have an MVP proof, re-open. |
I reproduced the issue here: https://github.com/paulzacz/edit-package-json-issue-47-repro Two significant edits:
|
Yes, that's a common pattern, but a deprecated pattern. The major feature of Typescript 4.7.3 was first-class support for Node16 modules. Previously, Typescript didn't know about package.json exports, now it does so long as you have the correct tsconfig settings to enable it. Once it starts paying attention to "exports", it ignores the top-level "main" and "types". |
Thank you! Reopening. |
linking TS ticket that discusses this microsoft/TypeScript#49160 |
Fixed in v0.6.5 patch, I checked the reproduction repo, types load fine. Closing. Thank you for all the help! |
Thank you as well. I had no idea you auto-generated your own package.json files so extensively. Also, I didn't know that JavaScript preserved the order of its object keys internally. I just assumed they were unordered hash maps under the hood. |
Wow, thanks for the quick reply. Being able to add new keys or set the
DEBUG flag would also be nice, but are more work.
…On Fri, Jun 24, 2022, 1:21 PM Roy Revelt ***@***.***> wrote:
Thank you for reporting that and sorry for the bug. I'll patch it this
weekend.
—
Reply to this email directly, view it on GitHub
<#47 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQNP3ZNJMVGDGY4U2PK2GLVQXVBDANCNFSM5ZYHH5GQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Package's name
Which package from the monorepo is it for?
edit-package-json
Describe the bug
A clear and concise description of what the bug is.
Typescript cannot find the types for
edit-package-json
when using "moduleResolution": "Node16", on typescript v4.7.3To Reproduce
Steps to reproduce the behavior:
tsconfig.json
Sample file:
Error message:
Expected behavior
Typescript is able to find the type definitions.
Additional context
Typescript 4.7.3 added support for ESM modules in node.js, including the "exports" keyword in package.json. The relevant portion of package.json for edit-package-json is as follows:
As written, Typescript 4.7.3 is looking for
./dist/edit-package-json.esm.d.ts
, but that files does not exist. Either add a "types" within the "exports" section pointing to the right file, or change the build process to output a definition file in the expected location with the expected name. Typescript 4.7.3 exports referenceThe text was updated successfully, but these errors were encountered: