Use the types
field in package.json. If you need to ship different types based on what version of TypeScript the end user is using, you can use typesVersions
.
How do I specify the types for my package?
You can also use typesVersions
to map names to files.
"typesVersions ": {
"*": {
"index.d.ts": "types/index.d.ts"
},
}
Now when your user imports index.d.ts
, they will get types/index.d.ts
.