Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ask NPM to download the TypeScript source, not just the *.d.ts files

Is it possible to ask NPM to download the TypeScript source files for dependencies, instead of just the *.d.ts and compiled *.js files?

I'm using VS Code's Go To Definition feature, but for dependencies it just takes me to .d.ts files that lack implementation logic - this makes it harder to understand what my dependencies are doing.

Thanks!

like image 969
emchristiansen Avatar asked Oct 24 '25 17:10

emchristiansen


1 Answers

Downloading TypeScript source files via NPM is only possible if those files have been published to NPM. The general convention for TypeScript projects is to only publish the dist/ directory which is generated post-compilation, with .d.ts files included to aid development that uses the library. If this is the case, then the only (inconvenient) way to view the source TypeScript files is to find out if/where the source code is hosted.

like image 198
futur Avatar answered Oct 26 '25 07:10

futur