.d.ts source map allowing go to def to jump to source directly · Issue #14479 · microsoft/TypeScript (original) (raw)

I know it has been asked and discussed before, but I couldn't find an explanation why you recommend to export only the type definitions when publishing an npm package.

As a consumer of an npm package it is quite annoying to end up in d.ts files when browsing code. Especially because I have to switch to the generate, down-leveled JS code to read the actual implementation. It is not only much less readable but also no longer well supported by my editor (no types).

I understand that the tsconfig is important and that one doesn't want to recompile typescript code from npm packages, but the tools should really show the original source instead of the generated code.

I am working on a monorepo project with a bunch of local npm packages with references. We use synthetic links (learna) and in package.jsonwe point to src/index.ts instead of the usual lib/index.d.ts. As a result I can nicely navigate between the local packages and never end up in generated files. With vscode that is, not so much with webstorm...
So at least in our context it seem to be an improvement.

Could you explain what problems this could cause and why you generally seem to recommend not to it like this?