-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Typescript error when trying to expose slot to parents using generic #11671
Comments
/cc @so1ve |
Hello, I've been thinking about this. How about making Slot type a bit more flexible? core/packages/runtime-core/src/componentSlots.ts Lines 26 to 28 in fbc0c42
I think changing type of core/packages/runtime-core/src/componentSlots.ts Lines 87 to 113 in fbc0c42
const normalizeSlot = <T extends any>(
key: string,
rawSlot: Slot<T>,
ctx: ComponentInternalInstance | null | undefined,
): Slot<T> => {
} What do you think? Let me know if you spot any potential issues or have ideas to make it even better! |
@Procrustes5 PR welcome. |
Works as expected |
Thanks! |
Should I close the issue ? |
Closing as not related to core |
Vue version
3.4.38
Link to minimal reproduction
https://github.com/AloisH/vue-3-generic-type-bug-with-slots
Steps to reproduce
Clone the repository
https://github.com/AloisH/vue-3-generic-type-bug-with-slots
Run
npm install
Run
npm run type-check
How to manualy reproduce the error:
Here is a simple example on how to reproduce it
ParentComp.vue
ChildComp
This only happens to generic template
if we remove from ChildComp the generic no more typescript error will occur
Example with working version:
ChildComp
What is expected?
No error from typescript
What is actually happening?
We found 2 errors
System Info
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: