@ -18,6 +18,14 @@ export interface ComponentConstructorOptions<
$$inline? : boolean ;
$$inline? : boolean ;
}
}
// 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
type PropsWithChildren < Props , Slots > = Props &
( Props extends { children? : any }
? { }
: Slots extends { default : any }
? { children? : Snippet }
: { } ) ;
/ * *
/ * *
* Can be used to create strongly typed Svelte components .
* Can be used to create strongly typed Svelte components .
*
*
@ -57,13 +65,13 @@ export class SvelteComponent<
* is a stop - gap solution . Migrate towards using ` mount ` or ` createRoot ` instead . See
* is a stop - gap solution . Migrate towards using ` mount ` or ` createRoot ` instead . See
* https : //svelte-5-preview.vercel.app/docs/breaking-changes#components-are-no-longer-classes for more info.
* https : //svelte-5-preview.vercel.app/docs/breaking-changes#components-are-no-longer-classes for more info.
* /
* /
constructor ( options : ComponentConstructorOptions < Props >) ;
constructor ( options : ComponentConstructorOptions < Props WithChildren< Props , Slots > >) ;
/ * *
/ * *
* For type checking capabilities only .
* For type checking capabilities only .
* Does not exist at runtime .
* Does not exist at runtime .
* # # # DO NOT USE !
* # # # DO NOT USE !
* * /
* * /
$$prop_def : Props ;
$$prop_def : Props WithChildren< Props , Slots > ;
/ * *
/ * *
* For type checking capabilities only .
* For type checking capabilities only .
* Does not exist at runtime .
* Does not exist at runtime .