diff --git a/types/test/options-test.ts b/types/test/options-test.ts index e1edff3f5ad..a62d9bb259a 100644 --- a/types/test/options-test.ts +++ b/types/test/options-test.ts @@ -1,4 +1,4 @@ -import Vue from "../index"; +import Vue, { VNode } from "../index"; import { AsyncComponent, ComponentOptions, FunctionalComponentOptions } from "../index"; import { CreateElement } from "../vue"; @@ -277,6 +277,19 @@ 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') { + const first = slot[0] + if (!Array.isArray(first) && typeof first !== 'string') { + return first; + } + } + return h(); + } +}) + Vue.component('functional-component', { props: ['prop'], functional: true, diff --git a/types/vnode.d.ts b/types/vnode.d.ts index 2fd2ef13c59..5754c433dcd 100644 --- a/types/vnode.d.ts +++ b/types/vnode.d.ts @@ -3,9 +3,7 @@ import { Vue } from "./vue"; export type ScopedSlot = (props: any) => VNodeChildrenArrayContents | string; export type VNodeChildren = VNodeChildrenArrayContents | [ScopedSlot] | string; -export interface VNodeChildrenArrayContents { - [x: number]: VNode | string | VNodeChildren; -} +export interface VNodeChildrenArrayContents extends Array {} export interface VNode { tag?: string;