Skip to content

Commit c603553

Browse files
authored
docs: fix ComponentProps info (#13827)
* docs: fix ComponentProps info closes #13770 * fix
1 parent 2d69a64 commit c603553

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/svelte/src/index.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,11 @@ export type ComponentEvents<Comp extends SvelteComponent> =
210210
* import MyComponent from './MyComponent.svelte';
211211
*
212212
* // Errors if these aren't the correct props expected by MyComponent.
213-
* const props: ComponentProps<MyComponent> = { foo: 'bar' };
213+
* const props: ComponentProps<typeof MyComponent> = { foo: 'bar' };
214214
* ```
215215
*
216+
* > [!NOTE] In Svelte 4, you would do `ComponentProps<MyComponent>` because `MyComponent` was a class.
217+
*
216218
* Example: A generic function that accepts some component and infers the type of its props:
217219
*
218220
* ```ts

packages/svelte/types/index.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,11 @@ declare module 'svelte' {
207207
* import MyComponent from './MyComponent.svelte';
208208
*
209209
* // Errors if these aren't the correct props expected by MyComponent.
210-
* const props: ComponentProps<MyComponent> = { foo: 'bar' };
210+
* const props: ComponentProps<typeof MyComponent> = { foo: 'bar' };
211211
* ```
212212
*
213+
* > [!NOTE] In Svelte 4, you would do `ComponentProps<MyComponent>` because `MyComponent` was a class.
214+
*
213215
* Example: A generic function that accepts some component and infers the type of its props:
214216
*
215217
* ```ts

0 commit comments

Comments
 (0)