-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
move @sveltejs/kit/node types out of ambient.d.ts #9883
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
|
|
Oh, and the process for generating the docs will need to be updated |
|
Alright, it turns out that this won't work in its current form — this almost works as a linked package (it just fails to auto-import) where the symlinks resolve to a directory outside a I'm convinced there must be a solution to this, because it would be too daft for there not to be a solution. Either way, if we're forced to generate |
|
https://www.typescriptlang.org/tsconfig#declarationMap hopefully this can point back to the original JS file too. |
|
closing this for now, until we get a chance to build a tool for generating .d.ts bundles correctly |
This PR will, if it succeeds, fix one of my long-standing bugbears with the SvelteKit codebase (albeit one that it shares with just about every other package): if you click 'go to definition' on something imported from Kit, VSCode will take you do the type definitions instead of the actual code.
In other words, if you click 'go to definition' on this function...
...then today it will take you here:
Tomorrow, it will take you here:
From a debugging and understanding perspective, this is vastly preferable.
It will also fix the fact that we always have to make changes in multiple places whenever we update stuff — you need to change the interface/documentation in
ambient.d.tsand also update the code that uses the interface. This is stupid. The documentation and the interfaces should be defined in the code itself.One issue I'm currently facing is that auto-import no longer works. I'm not sure why, but I'm going to blindly proceed on the assumption that it's fixable somehow.
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm testand lint the project withpnpm lintandpnpm checkChangesets
pnpm changesetand following the prompts. Changesets that add features should beminorand those that fix bugs should bepatch. Please prefix changeset messages withfeat:,fix:, orchore:.