You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, acoording to the type definition a scoped slot function always has to return an array:
// scopedSlot callback:renderSlotContent(props: ScopeProps){// must return array according to type definition:return([<span>asdadsf</span>]);},
But, it is also possible to directly return an element / node without wrapping it in array:
// scopedSlot callback:renderSlotContent(props: ScopeProps){// vue accepts this and it renders correctlyreturn<span>asdadsf</span>;},
At the same time typescript complains about this, because it assumes that the return type must be VNodeChildrenArrayContents | string.
Now, I have almost no knowledge about Vue render functions and VNodes and such...but why does the return type has to be an array? Is there a specific reason?
And, can that type definition be made more flexible so typescript stops complaining if the callback function returns a node directly (without wrapping it in an array)?
Thank you very much,
and thanks for this great library!
The text was updated successfully, but these errors were encountered:
blake-newman
added a commit
to blake-newman/vue-tsx-support
that referenced
this issue
Dec 11, 2018
- Update vue dependencies
- Fix scoped slots definitions to be compatible with Vue typings
- ScopedSlots can be undefined as there is no guarantee that the scoped
slot has to be passed. vuejs/vue@448ba65
- Fixeswonderful-panda#11
- Update vue dependencies
- Fix scoped slots definitions to be compatible with Vue typings
- ScopedSlots can be undefined as there is no guarantee that the scoped
slot has to be passed. vuejs/vue@448ba65
- Fixeswonderful-panda#11
Currently, scopedSlots are defined to accept a function that returns
VNodeChildrenArrayContents | string
:So, acoording to the type definition a scoped slot function always has to return an array:
But, it is also possible to directly return an element / node without wrapping it in array:
At the same time typescript complains about this, because it assumes that the return type must be
VNodeChildrenArrayContents | string
.Now, I have almost no knowledge about Vue render functions and VNodes and such...but why does the return type has to be an array? Is there a specific reason?
And, can that type definition be made more flexible so typescript stops complaining if the callback function returns a node directly (without wrapping it in an array)?
Thank you very much,
and thanks for this great library!
The text was updated successfully, but these errors were encountered: