Skip to content
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

support allowArbitraryExtensions #1183

Open
holic opened this issue Aug 15, 2024 · 0 comments
Open

support allowArbitraryExtensions #1183

holic opened this issue Aug 15, 2024 · 0 comments

Comments

@holic
Copy link

holic commented Aug 15, 2024

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)).

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant