File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change 1- import Vue from "../index" ;
1+ import Vue , { VNode } from "../index" ;
22import { AsyncComponent , ComponentOptions , FunctionalComponentOptions } from "../index" ;
33import { CreateElement } from "../vue" ;
44
@@ -277,6 +277,19 @@ Vue.component('component-with-scoped-slot', {
277277 }
278278} )
279279
280+ Vue . component ( 'narrow-array-of-vnode-type' , {
281+ render ( h ) : VNode {
282+ const slot = this . $scopedSlots . default ( { } )
283+ if ( typeof slot !== 'string' ) {
284+ const first = slot [ 0 ]
285+ if ( ! Array . isArray ( first ) && typeof first !== 'string' ) {
286+ return first ;
287+ }
288+ }
289+ return h ( ) ;
290+ }
291+ } )
292+
280293Vue . component ( 'functional-component' , {
281294 props : [ 'prop' ] ,
282295 functional : true ,
Original file line number Diff line number Diff line change @@ -3,9 +3,7 @@ import { Vue } from "./vue";
33export type ScopedSlot = ( props : any ) => VNodeChildrenArrayContents | string ;
44
55export type VNodeChildren = VNodeChildrenArrayContents | [ ScopedSlot ] | string ;
6- export interface VNodeChildrenArrayContents {
7- [ x : number ] : VNode | string | VNodeChildren ;
8- }
6+ export interface VNodeChildrenArrayContents extends Array < VNode | string | VNodeChildrenArrayContents > { }
97
108export interface VNode {
119 tag ?: string ;
You can’t perform that action at this time.
0 commit comments