-
Notifications
You must be signed in to change notification settings - Fork 363
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
Guidance around exports.types config when authoring in TS #990
Comments
Would love docs there if you're willing. Adding that to the main |
Sorry to dig up a closed issue, but just wanted to clarify - does the It kind of reads that way to me in the docs, so I'm a tad confused:
The above reads to me as though it will automatically find the declaration file as long as it's colocated with the file specified under import/require, if not, then you need to point |
Theoretically. I've had some issues with that in the past so I don't really trust their lookup mechanisms. It's a tad fragile too.
It needs to be colocated and match the file name, i.e, if the imported file is |
I'm authoring a module in TypeScript that I'm bundling and publishing with
microbundle
. I would like the published module to be importable from a wide range of projects, with the generated TypeScript definitions to be available as well.The "Using with TypeScript" guide does not mention one piece of configuration that I've found necessary. In order to produce a module that can be imported from TypeScript projects with
moduleResolution: "NodeNext"
configured, with the.d.ts
definitions available as well, I needed to add anexports.types
field to my module'spackage.json
config.Without adding in that
types
field, I get the standardts(7016)
error when using my module frommoduleResolution: "NodeNext"
projects, informing me that there are no type definitions.I'm happy to file a PR against the
microbundle
docs instructing developers to setexports.types
for maximum compatibility with modern TypeScript.The text was updated successfully, but these errors were encountered: