diff --git a/types/test/options-test.ts b/types/test/options-test.ts index 17a54fd360b..f48feec993c 100644 --- a/types/test/options-test.ts +++ b/types/test/options-test.ts @@ -307,11 +307,15 @@ Vue.component('component-with-scoped-slot', { Vue.component('narrow-array-of-vnode-type', { render (h): VNode { const slot = this.$scopedSlots.default({}) - if (typeof slot !== 'string') { + if (Array.isArray(slot)) { const first = slot[0] if (!Array.isArray(first) && typeof first !== 'string') { return first; } + } else if (typeof slot === 'string') { + return h('div', slot.toUpperCase()) + } else { + return slot } return h(); } diff --git a/types/vnode.d.ts b/types/vnode.d.ts index 5754c433dcd..8c4ef675e58 100644 --- a/types/vnode.d.ts +++ b/types/vnode.d.ts @@ -1,6 +1,6 @@ import { Vue } from "./vue"; -export type ScopedSlot = (props: any) => VNodeChildrenArrayContents | string; +export type ScopedSlot = (props: any) => VNodeChildrenArrayContents | VNode | string; export type VNodeChildren = VNodeChildrenArrayContents | [ScopedSlot] | string; export interface VNodeChildrenArrayContents extends Array {}