File tree 4 files changed +14
-2
lines changed 4 files changed +14
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " svelte " : patch
3
+ ---
4
+
5
+ fix: relax constraint for ` ComponentProps `
Original file line number Diff line number Diff line change @@ -198,7 +198,7 @@ export type ComponentEvents<Comp extends SvelteComponent> =
198
198
* </script>
199
199
* ```
200
200
*/
201
- export type ComponentProps < Comp extends SvelteComponent | Component > =
201
+ export type ComponentProps < Comp extends SvelteComponent | Component < any > > =
202
202
Comp extends SvelteComponent < infer Props >
203
203
? Props
204
204
: Comp extends Component < infer Props >
Original file line number Diff line number Diff line change @@ -231,6 +231,13 @@ functionComponentInstance.foo === 'bar';
231
231
// @ts -expect-error
232
232
functionComponentInstance . foo = 'foo' ;
233
233
234
+ const functionComponentProps : ComponentProps < typeof functionComponent > = {
235
+ binding : true ,
236
+ readonly : 'foo' ,
237
+ // @ts -expect-error
238
+ prop : 1
239
+ } ;
240
+
234
241
mount ( functionComponent , {
235
242
target : null as any as Document | Element | ShadowRoot ,
236
243
props : {
Original file line number Diff line number Diff line change @@ -195,7 +195,7 @@ declare module 'svelte' {
195
195
* </script>
196
196
* ```
197
197
*/
198
- export type ComponentProps < Comp extends SvelteComponent | Component > =
198
+ export type ComponentProps < Comp extends SvelteComponent | Component < any > > =
199
199
Comp extends SvelteComponent < infer Props >
200
200
? Props
201
201
: Comp extends Component < infer Props >
You can’t perform that action at this time.
0 commit comments