sxzz / tsdown

An even faster bundler powered by Rolldown.
https://jsr.io/@sxzz/tsdown
MIT License
330 stars 7 forks source link

TypeScript can't infer the type of `defineConfig` #26

Closed SuperchupuDev closed 3 months ago

SuperchupuDev commented 3 months ago

Describe the bug

Exporting config with the format export default defineConfig makes TypeScript throw The inferred type of 'default' cannot be named without a reference to './node_modules/tsdown/dist/options'. This is likely not portable. A type annotation is necessary. ts(2742). A workaround could be using a type annotation, but that's not possible due to the Options type not being exported

Reproduction

https://pastebin.com/R7BspErm

System Info

System:
  OS: Windows 10 10.0.19045
  CPU: (8) x64 Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz
  Memory: 5.77 GB / 15.84 GB
Binaries:
  Node: 22.6.0 - ~\AppData\Local\fnm_multishells\12976_1723564053163\node.EXE
  npm: 10.8.2 - ~\AppData\Local\fnm_multishells\12976_1723564053163\npm.CMD
  pnpm: 9.6.0 - ~\AppData\Local\fnm_multishells\12976_1723564053163\pnpm.CMD
Browsers:
  Edge: Chromium (127.0.2651.74)
  Internet Explorer: 11.0.19041.4355

Used Package Manager

pnpm

Validations

sxzz commented 3 months ago

Fixed & released as tsdown@0.2.6