Closed
Description
(I realize this is really more of a TS question than it is an attw
question, but given our recent discussions I figured it was worth filing here. Feel free to close this once you see it.)
I'm working on redoing the redux-thunk
build setup atm, and also trying out https://github.com/egoist/tsup as a potential build tool.
My current package setup looks like this:
"main": "dist/cjs/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"default": "./dist/cjs/index.cjs"
},
"./extend-redux": {
"types": "./extend-redux.d.ts"
}
},
Using the CLI wrapper I've set up for attw
, I get this output:
I'm getting that FalseCJS
warning, and I'm guessing it's because I have dist/index.mjs
but dist/index.d.ts
.
A few questions based on that:
- How critical is that mismatch in general? I know you've mentioned that "CJS and ESM output files can/should have different types". How much of a concern is that actually in practice? How much effort should I spend on trying to resolve this
attw
warning? tsup
doesn't currently have a way to generate.d.mts
output , per [feature] Generate esm-specific declaration files egoist/tsup#760 . Is it reasonable to copy overindex.d.ts
->index.d.mts
in this case?redux-thunk
only has the one outputindex.d.ts
file. For RTK, we have many source files, and thus many.d.ts
files:- Does only the
index.d.mts
file need to exist with that extension (ie, there could beindex.d.mts
andotherFile.d.ts
and that would work)? Or does every output declaration file need to have the.d.mts
extension for TS to load those properly in the ESM case?
- Does only the
- We've briefly discussed trying to bundle up TS declarations. What is the right tool for that currently?
Metadata
Metadata
Assignees
Labels
No labels