pull/13827/head
Simon Holthausen 2 years ago
parent 728a805316
commit 9b47e34987

@ -213,8 +213,7 @@ export type ComponentEvents<Comp extends SvelteComponent> =
* const props: ComponentProps<typeof MyComponent> = { foo: 'bar' }; * const props: ComponentProps<typeof MyComponent> = { foo: 'bar' };
* ``` * ```
* *
* > [!NOTE] * > [!NOTE] In Svelte 4, you would do `ComponentProps<MyComponent>` because `MyComponent` was a class.
* > In Svelte 4, you would do `ComponentProps<MyComponent>` because `MyComponent` was a class.
* *
* Example: A generic function that accepts some component and infers the type of its props: * Example: A generic function that accepts some component and infers the type of its props:
* *

@ -207,9 +207,11 @@ declare module 'svelte' {
* import MyComponent from './MyComponent.svelte'; * import MyComponent from './MyComponent.svelte';
* *
* // Errors if these aren't the correct props expected by MyComponent. * // Errors if these aren't the correct props expected by MyComponent.
* const props: ComponentProps<MyComponent> = { foo: 'bar' }; * const props: ComponentProps<typeof MyComponent> = { foo: 'bar' };
* ``` * ```
* *
* > [!NOTE] In Svelte 4, you would do `ComponentProps<MyComponent>` because `MyComponent` was a class.
*
* Example: A generic function that accepts some component and infers the type of its props: * Example: A generic function that accepts some component and infers the type of its props:
* *
* ```ts * ```ts

Loading…
Cancel
Save