-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
fix: ensure createEventDispatcher works with types from generics #8872
Conversation
fixes #8860 This contains a small but unfortunately unavoidable breaking change: If you used `never` to type that the second parameter shouldn't be set (which the docs recommended for a short time), then you need to change that to `null`
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.
I will admit to having limited understanding of the explanation, but it sounds like this is necessary based on microsoft/TypeScript#54806, so lgtm
We'll need to do the same for the Action interface 😞 will get to it later |
Hey! I observed a few interesting behaviors regarding the new
I thought it was interesting to mention here, as tightening types might be a breaking change |
Thanks for testing these out! The new behavior is actually more correct, as The last insight is actually unrelated, it's how the Svelte language server resolves these types - that hasn't changed, but should probably adjusted to be |
We had to change the eventDispatcher for events that shouldn't have a second parameter to `null` instead of `never`. See: sveltejs/svelte#8872 Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
We had to change the eventDispatcher for events that shouldn't have a second parameter to `null` instead of `never`. See: sveltejs/svelte#8872 Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
fixes #8860
This contains a small but unfortunately unavoidable breaking change: If you used
never
to type that the second parameter shouldn't be set (which the docs recommended for a short time), then you need to change that tonull
:Same for
ActionReturn
- useundefined
instead ofnever
: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