-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
feat: add ComponentExports
utility type
#13441
base: main
Are you sure you want to change the base?
Conversation
|
Note that some previous change (which may be the one being referred to here) broke @testing-library/svelte's TypeScript support. I mention this here because perhaps it could be verified. |
Very cool, so much nicer to code with. I get this warning in VS code, does this have to be suppressed globally or is there a better way to avoid it?
Update: I believe it's required to ignore the above warning. See my comment here for my use case and the related discussion: #13104 (comment) |
If I understand correctly this is not related to this PR, this is just a utility type, to type the |
I tried to say it was just a use case connection (adoption friction for bind:this) for context if anyone was prioritising/triaging, so not technical/code related to this PR specifically. Apologies if it was unhelpful. |
With the type change for
bind:this
on components (related issues are this language-tools issue and 13430).Recommended way is to do this (per this comment):
Since we currently have the
Component
type exported by svelte that has theExports
we can rely on that and do this instead:Whats the problem with using
ReturnType
?This is the safer/forward-compatibale way that the svelte can decide on the type.
Svelte 5 rewrite
Please note that the Svelte codebase is currently being rewritten for Svelte 5. Changes should target Svelte 5, which lives on the default branch (
main
).If your PR concerns Svelte 4 (including updates to svelte.dev.docs), please ensure the base branch is
svelte-4
and notmain
.Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.Tests and linting
pnpm test
and lint the project withpnpm lint