-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
write generated types to __types directories #4705
Conversation
🦋 Changeset detectedLatest commit: 82d85b1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
If we do end up doing this, i wonder if we should make the same change to the JSDoc comments, and the examples in the docs: -/** @type {import('./index').RequestHandler} */
+/** @type {import('./index.d').RequestHandler} */ It works either way, but there might be some value in consistency |
I'm not a Typescript expert, but Microsoft seems to think having files with the same name, (e.g. Maybe one solution would be to put the generated types file in Tangentially related, I'd like to have my *.d.ts files in |
I second this. The TS resolution algorithm has a certain order to resolve files (ts>dts>js, this is why the solution in this PR works because it first appends the ts ending) and I think it wasn't intended to support two files which only differ by file ending. The more robust fix would therefore probably be to create a type file name that is distinct, for example taking advantage of our "double underscore is reserved": |
I third it. |
I suppose I'd lean towards:
|
Updated to use |
Yeah, this fits |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me apart from the seemingly unrelated packaging changes
/** | ||
* @type {import('./foo').Foo} | ||
*/ | ||
export let foo; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These also seem unrelated, but possibly ok to keep because else prettier complains (?)
svelte-kit sync
happens #4973Changes where generated types are written to:
though the fix seems a bit... unidiomatic? would love a gut check from typescript-heads. little surprised this didn't come up soonerPlease don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpx changeset
and following the prompts. All changesets should bepatch
until SvelteKit 1.0