Enabling allowAbitraryExtensions
defines DTS files as .d.{extension}.ts
.
I'm trying to create strongly-typed JSON files by generating a .d.json.ts
for each one I need strong types for (until we get importing JSON as const
).
tsup doesn't seem to skip these files when generating DTS and instead assumes they're a TS file to be built, but then dies on the declare const
syntax.
DTS Build error
Unexpected token (Note that you need plugins to import files that are not JavaScript)
1: declare const abi: [
^
2: {
3: "type": "function",
(oddly this nice error shows up for tsup version ^6.7.0 but not ^8.2.4 and instead only shows "DTS Build error" with no details)
I've tried to work around this with various ignore/exclude options, but nothing seems to work. The TS maintainers suggest that tsup is missing support for the .d.{extension}.ts
format enabled by allowArbitraryExtensions
(see conversation in microsoft/TypeScript#49703 (comment)).
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too