Skip to content
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: relax component constructor type #2524

Merged
merged 1 commit into from
Sep 27, 2024

Conversation

dummdidumm
Copy link
Member

@dummdidumm dummdidumm commented Sep 27, 2024

Since #2517 we're no longer adding the [evt: string]: CustomEvent<any> index signature to components in runes mode not using createEventDispatcher. This revealed a type bug in our ATypedSvelteComponent type. It was to restricting, because TypeScript will resolve the empty event object to a handler with callback type never, which then means the __sveltets_2_ensureComponent generic no longer picks the right type, resulting in generics not being resolved properly. Fix this by relaxing the constraints.

Fixes #2523

Since , we're no longer adding the `[evt: string]: CustomEvent<any>` index signature to components in runes mode not using `createEventDispatcher`. This revealed a type bug in our `ATypedSvelteComponent` type. It was to restricting, because TypeScript will resolve the empty event object to a handler with callback type `never`, which then means the `__sveltets_2_ensureComponent` generic no longer picks the right type, resulting in generics not being resolved properly. Fix this by relaxing the constraints.

Fixes #2523
@dummdidumm dummdidumm merged commit 4dfb988 into master Sep 27, 2024
3 checks passed
@dummdidumm dummdidumm deleted the relax-component-constructor-type branch September 27, 2024 20:56
@webJose
Copy link

webJose commented Oct 1, 2024

@dummdidumm does this fix sveltejs/svelte#12785? I detailed this problem in this discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

svelte2tsx 0.7.20 breaks generics outside of Library Project
2 participants