-
Notifications
You must be signed in to change notification settings - Fork 68
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
fix: Add types
field to package.json
#75
Conversation
The upcoming TypeScript 4.5.0 version has a new stricter module resolution algorithm that more closely follows Node's resolution: `node12`. It requires packages to explicitly define their exported types, either with a `types` or `export.types` field in `package.json`. This commit fixes the `package.json` so it can be consumed by projects using TypeScript 4.5.0 and the `node12` resolution algorithm.
Nice, thanks for the heads up! Can you provide a link to their documentation on this change, please? |
Here is the blog post announcing TypeScript 4.5.0 and the new resolution algorithm: https://devblogs.microsoft.com/typescript/announcing-typescript-4-5-beta/#esm-nodejs. I don't believe the actual details are fully documented yet: I am using the TypeScript PR directly as a reference when trying out the new mode in my projects. I also already encountered this issue and fixed it this way for |
Hm, when I searched I saw that, but it seems to say it is only necessary if you don't want the default value or you are using |
This small repo reproduces the issue: https://github.com/demurgos/raw-body-ts-node-12 Adding any of the following to
|
Hi @demurgos and sorry I let this linger. I really appreciate your repo, because I'm not used to setting up typescript projects it is a big help. I took a look and the issue seems to be an issue with the node12 resolution system. You see, normally TypeScript will see what the imported file is for a package (using the
When you use
As soon as I add either
It would be reasonable to conclude here that there is a bug in the I hope this helps. |
The upcoming TypeScript 4.5.0 version has a new stricter module resolution algorithm that more closely follows Node's resolution:
node12
. It requires packages to explicitly define their exported types, either with atypes
orexport.types
field inpackage.json
.This commit fixes the
package.json
so it can be consumed by projects using TypeScript 4.5.0 and thenode12
resolution algorithm.