-
-
Notifications
You must be signed in to change notification settings - Fork 158
Detect 'types' fields nested in "exports" #885
Copy link
Copy link
Open
Labels
Description
Reproduction link or steps
import { defineConfig } from "tsdown";
export default defineConfig({
entry: "index.ts",
fixedExtension: false,
format: {
esm: {
outDir: "esm/",
},
cjs: {
outDir: "cjs/",
},
},
});package.json:
{
"exports": {
".": {
"import": {
"default": "./esm/index.js",
"types": "./esm/index.d.ts"
},
"require": {
"default": "./cjs/index.cjs",
"types": "./cjs/index.d.cts"
}
}
}
}What is expected?
The construct above should be enough for tsdown to generate types.
What is actually happening?
Types are not generated, since it only looks for types or typings at the top level.
Any additional comments?
One subtlety: if the "." entry contains a "types" field, but the "require" entry does not contain a "types" field, the types should be generated for one module but not the other. Tricky tricky.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Fields
Give feedbackPriority
None yet
Effort
None yet