-import { Slot } from '../componentSlots'
import { isArray } from '@vue/shared'
+import { VNode } from '../vnode'
+
+// #6651 res can be undefined in SSR in string push mode
+type SSRSlot = (...args: any[]) => VNode[] | undefined
interface CompiledSlotDescriptor {
name: string
- fn: Slot
+ fn: SSRSlot
key?: string
}
* @private
*/
export function createSlots(
- slots: Record<string, Slot>,
+ slots: Record<string, SSRSlot>,
dynamicSlots: (
| CompiledSlotDescriptor
| CompiledSlotDescriptor[]
| undefined
)[]
-): Record<string, Slot> {
+): Record<string, SSRSlot> {
for (let i = 0; i < dynamicSlots.length; i++) {
const slot = dynamicSlots[i]
// array of dynamic slot generated by <template v-for="..." #[...]>
const res = slot.fn(...args)
// attach branch key so each conditional branch is considered a
// different fragment
- // #6651 res can be undefined in SSR in string push mode
if (res) (res as any).key = slot.key
return res
}