DEV Community

[Comment from a deleted post]
Collapse
 
lyrod profile image
Lyrod

Great article. Have you examples of multiple TypeScript files when generating .d.ts (import from multiple files) ?
Because esbuild bundle all files into one, tsc will not and all d.ts will not match the bundled JavaScript. You will have a bundled.js and fileA.d.ts, fileB.d.ts (example source files, if we have fileA.ts and fileB.ts)

I know you could not use bundle and compile all .ts into multiple .js and d.ts sync will be fixed, but using bundle, you can't.

Collapse
 
daviddalbusco profile image
David Dal Busco

You are right, it will generate multiple .d.ts files but, one .js file.

It worked out for my project, as was able to import the libs and use their typescript declaration.

Can check these libs there github.com/deckgo/deckdeckgo/tree/...

This one is the related discussion / issue in the esbuild GitHub repo and why I went with tsc to generate the declarations.