You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: type-level back-compat for default slot and children prop
If someone has an existing SvelteComponent type definition and using the slot generic to type the default slot, automatically add that slot to the prop type as "children"
// Utility type for ensuring backwards compatibility on a type level: If there's a default slot, add 'children' to the props if it doesn't exist there already
22
+
typePropsWithChildren<Props,Slots>=Props&
23
+
(Propsextends{children?: any}
24
+
? {}
25
+
: Slotsextends{default: any}
26
+
? {children?: Snippet}
27
+
: {});
28
+
21
29
/**
22
30
* Can be used to create strongly typed Svelte components.
23
31
*
@@ -57,13 +65,13 @@ export class SvelteComponent<
57
65
* is a stop-gap solution. Migrate towards using `mount` or `createRoot` instead. See
58
66
* https://svelte-5-preview.vercel.app/docs/breaking-changes#components-are-no-longer-classes for more info.
0 commit comments