fix(components): improve slots return types
๐ Linked issue
Resolves #5232
โ Type of change
- [ ] ๐ Documentation (updates to the documentation or readme)
- [x] ๐ Bug fix (a non-breaking change that fixes an issue)
- [ ] ๐ Enhancement (improving an existing functionality)
- [ ] โจ New feature (a non-breaking change that adds functionality)
- [ ] ๐งน Chore (updates to the build process or auxiliary tools and libraries)
- [ ] โ ๏ธ Breaking change (fix or feature that would cause existing functionality to change)
๐ Description
Until the last update for the builder we weren't able to properly and strongly type various aspects about props, slots and emits. Now the issue has been fixed by slots were left unchanged (all being required and return was any). With this change normal use in the template won't change, but does greatly increase the typing experience when using render functions (required for the current UTable implementation).
๐ Checklist
- [x] I have linked an issue or discussion.
- [ ] I have updated the documentation accordingly.
@benjamincanac could I ask you to double check the various default slots and which could be optional and which must be required? For example most of Prose* components would require the default slot, as well the Form* components.
@sandros94 Should we also update all resolveComponent instances with #components import?
@sandros94 Should we also update all
resolveComponentinstances with#componentsimport?
To provide typing? Shouldn't resolveComponent also resolve them?
It doesn't work on my end, but if you say resolveComponent works why bother rewriting all slots? ๐ค
When writing in tsx with h it provides type error when passing invalid objects and classes as return, as they need proper destructuring/stringification (something we are used with via {{ ... }} in the template)
Yes but only when importing from #components not when using resolveComponent right?