Closed nzakas closed 1 month ago
index.d.ts
type.d.ts
and a type.ts
file. index.d.ts
index.d.ts
refers to types inside type.ts
in that case why do we have type.d.ts
(this seems like exact replica of type.ts
)
type.ts
in the esm and cjs of dist folder as index.js imports declarations. In that case should we actually remove the copy plugin that does the exact same thing? in that case why do we have
type.d.ts
(this seems like exact replica oftype.ts
)
tsc
generates this. Maybe it's not needed, but I don't see the harm in leaving it. No need to add another step to the process.
2. One more thing that I noticed is I removed all tsconfig.json and built the package just with plain rollup and still can see
type.ts
in the esm and cjs of dist folder as index.js imports declarations. In that case should we actually remove the copy plugin that does the exact same thing?
I'm guessing that you didn't delete dist
before doing this. If you delete dist
and try npm run build
without Rollup copying over types.ts
, you'll get a tsc
error.
This simplifies the generation of type definitions.
// @ts-self-types
comment to specify types in the rolled-up packages, eliminating the need for a separate step to add a triple-slash directive.tsconfig.cjs.json
configurations. It turns out we can just copy overindex.d.ts
toindex.d.cts
and TypeScript will be happy.