You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A user of this lib who is using TS will find that the "types" field above will not be used unless they have "moduleResolution": "nodenext" or "moduleResolution": "node16" in their tsconfig. (In practice this only affects subpaths require("my-lib/subpath") because the top-level "types" field will be looked up for the main entrypoint.). The issue relates to us specifically because dnt forces explicit exports.
Otherwise we just have to document the requirement that an npm lib generated with dnt requires the lib user to have "moduleResolution": "nodenext" in their tsconfig for subpath imports to be typed.
The text was updated successfully, but these errors were encountered:
If your library has an exported subpath such that the following
package.json
is generated:A user of this lib who is using TS will find that the
"types"
field above will not be used unless they have"moduleResolution": "nodenext"
or"moduleResolution": "node16"
in their tsconfig. (In practice this only affects subpathsrequire("my-lib/subpath")
because the top-level"types"
field will be looked up for the main entrypoint.). The issue relates to us specifically becausednt
forces explicit exports.Should we open an upstream issue for TypeScript to apply
package.json:exports["./subpath"].types
resolution even for"moduleResolution": "node"
? The current restrictionisn't explicitlyis mentioned in https://devblogs.microsoft.com/typescript/announcing-typescript-4-5-beta/#packagejson-exports-imports-and-self-referencing, it's categorised under"nodenext"
support. But I think they'd be open to extending it to"node"
because it's not breaking in practice.Otherwise we just have to document the requirement that an npm lib generated with dnt requires the lib user to have
"moduleResolution": "nodenext"
in their tsconfig for subpath imports to be typed.The text was updated successfully, but these errors were encountered: