-
-
Notifications
You must be signed in to change notification settings - Fork 261
Add information about .d.ts.map TypeScript declaration maps #566
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
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/egoist/tsup/5JH35zdH8ZCxW8ySKzW7rdPcdazQ |
🎉 This PR is included in version 5.12.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Hello, I was reading the tsup docs today, and I came across this, but I do not think that this advice is correct. In fact, I think the advice is exactly opposite - every npm library should include declaration maps, since they are necessary in order for F12 to work properly. In other words:
This is a bug, because pressing F12 should warp to the actual TypeScript source code (e.g. "./node_modules/foo/src/functions/useFoo.ts"). But fixing this is trivial: all we have to do is set the I understand that currently, tsup does not support declaration maps, but the docs should at least be explaining correctly what declaration maps are for. @eric-burel @egoist Am I missing some key context? Do you want me to do a PR to rewrite this? |
@Zamiell I haven't worked in this area recently but I'd say it's a design choice for the package owner. Compiled JS/TS indeed have the default of losing the "white box" model of script languages. Actually even in a compiled Golang app, the "source is the documentation". In the Devographics codebase, our shared packages are TypeScript only so you can indeed jump to source: https://github.com/Devographics/Monorepo (see "shared" folders and how we use "@devographics/" packages) But they are not published so we have full control about the build environment they end up into. Maybe outputting TS code to clean ESM rather than ugly minified JS could be a solution. To answer your question more directly: I am not sure that including the TS sources is the way, maybe compiling to a human readable code would be better suited. |
I also program in Golang, and the solution I outlined in my previous reply makes TypeScript work identical to Golang in this respect, which is great.
Why though? What is the actual disadvantage of including the |
Closes #564