Add types to package exports
MI3Guy opened this issue · comments
MI3Guy commented
Motivation
When using TypeScript with "module": "ES2022"
with a package that defines exports
, the exports
mapping takes priority over types
. This means that the type definitions are looked up based on the .js
(or .mjs
) files under dist
, causing them to not be found.
Expected behavior
TypeScript finds the type definitions.
Actual behavior
TypeScript complains about missing type definitions.
This can be fixed by adding
"types": "./astring.d.ts",
as the first entry under exports
.
Tom Golden commented
David Bonnet commented