Skip to content

Commit

Permalink
docs: fix ComponentProps info (#13827)
Browse files Browse the repository at this point in the history
* docs: fix ComponentProps info

closes #13770

* fix
  • Loading branch information
dummdidumm authored Oct 23, 2024
1 parent 2d69a64 commit c603553
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/svelte/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,11 @@ export type ComponentEvents<Comp extends SvelteComponent> =
* import MyComponent from './MyComponent.svelte';
*
* // 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:
*
* ```ts
Expand Down
4 changes: 3 additions & 1 deletion packages/svelte/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,11 @@ declare module 'svelte' {
* import MyComponent from './MyComponent.svelte';
*
* // 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:
*
* ```ts
Expand Down

0 comments on commit c603553

Please sign in to comment.