change package.json
entry point and duplicate declaration
#32
Labels
enhancement
New feature or request
package.json
entry point and duplicate declaration
#32
Background
In TypeScript 4.7 it was recommended to export your package with a conditional nested export map such as:
This was recommended multiple times:
exports
inpackage.json
when generating CommonJS files microsoft/TypeScript#54263 (comment)Problem
The supposed reason is if a user consumes your package with a single shared
.d.ts
and has TypeScript, it might be like "oh ok this package only has ESM" or vice-versa.The following explanation was hosted on the domain https://www.typescriptlang.org/docs/handbook/esm-node.html:
In October 2023 the following module documentation was published microsoft/TypeScript-Website#2946
In the above PR the domain explaining why you shouldn't share a single
.d.ts
file was deleted. This explanation now only exists in the TypeScript 4.7 release notesResolution
Because it's unclear if users will face this issue, the following resolution should be done to accommodate users consuming this package with an older version of TypeScript should they encounter this issue:
package.json
to comply with multiple type files.d.ts
filesThe text was updated successfully, but these errors were encountered: