-
-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generics don't work properly when passing down slot props #1344
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Every issue you open is the most pressing you currently have. It's not like maintainers are idle and jump on every post you create. We will eventually get to answering these, and adding passive aggressive posts that are essentialy just elaborate "bump"s isn't helping. Locking and limiting the conversation on this issue, other people who have the same problem and could post actual helpful context but can't now, please thank @AradAral for that. |
Problem is that our transformation of the // is currently this
return { ..., slots: {'default': {errors:__sveltets_1_instanceOf(Form).$$slot_def['default'].errors}}, ... }}
// would need to be something like this
return { ..., slots: {'default': {errors:new Form({ target: __sveltets_2_any(), props: { values,}}).$$slot_def['default'].errors}}, ... }}
// or this:
declare function createComponent<Props, Events, Slots, T extends Svelte2TsxComponent<Props, Events, Slots>>(t: new (args: {target: any, props?: Props}) => T, p: Props) : T;
// ..
return { ..., slots: {'default': {errors:createComponent(Form, { values,}).$$slot_def['default'].errors}}, ... }} Fixing this is hard because we need to apply the same logic we apply in the context of each/await (unwrapping stuff) and additionally instantiate the component. |
Closing since Svelte 5 replaces slots with snippets and render tags, which don't have this problem (because you're required to type it properly) |
Consider the following components:
Form.svelte
:SpecialForm.svelte
:App.svelte
:In the last component (
App.svelte
), the slot properrors
doesn't have the right type, it's of typeErrors<unknown>
even though the generic type is properly detected forvalues
.I have quite a few components that have this kind of relationship, and generics are not working as expected currently, so I'd appreciate it if you fix this. Thank you.
The text was updated successfully, but these errors were encountered: