Closed Rich-Harris closed 1 year ago
This basically duplicates src/public.d.ts into types/index.d.ts with the addition of a sourcemap. Is there a way to get the same result without the sourcemap and all these moving parts? v-p-s types are tiny, if all it takes is changing src/index.d.ts to declare the module in place instead of using declare function i'm fine with that.
Is there a way to get the same result without the sourcemap and all these moving parts?
Unfortunately not, unless you want to create a sourcemap by hand. Though I think re-exporting from index.js
(so the function types are declared inline rather than with declare function
) will work in either case.
It does add moving parts and the benefit is more modest in this case since there's really just one giant .d.ts
file in src
— no pressure to merge this PR, I was largely just curious about what it would look like (and I found a couple of dts-buddy
bugs along the way, so it was worthwhile for me). Having cmd-click work properly is nice, but might not be worth the trade-off. Your call
changed to draft for now until we figure out how to integrate it properly
closing in favor of https://github.com/sveltejs/vite-plugin-svelte/pull/751
.d.ts
filetypes/index.d.ts
file is generated with an accompanyingtypes/index.d.ts.map
, meaning cmd-click takes you to the implementationUnfortunately couldn't use the CLI for this because the entry point is a
.d.ts
file rather than a.js
file, so this happens via a newscripts/generate-dts.js
module