From db2365efaa7d3fda125a994772137370d8cbe26f Mon Sep 17 00:00:00 2001 From: Sebastian Speitel Date: Sat, 21 Aug 2021 18:19:48 +0200 Subject: [PATCH] types(runtime-core): fix types of block creation fix: #4391 --- .../runtime-core/src/helpers/renderSlot.ts | 4 ++-- packages/runtime-core/src/vnode.ts | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/runtime-core/src/helpers/renderSlot.ts b/packages/runtime-core/src/helpers/renderSlot.ts index 9389cc28abe..15ec99be60f 100644 --- a/packages/runtime-core/src/helpers/renderSlot.ts +++ b/packages/runtime-core/src/helpers/renderSlot.ts @@ -14,7 +14,7 @@ import { } from '../vnode' import { PatchFlags, SlotFlags } from '@vue/shared' import { warn } from '../warning' -import { createVNode } from '@vue/runtime-core' +import { createVNode, VNodeProps } from '@vue/runtime-core' /** * Compiler runtime helper for rendering `` @@ -23,7 +23,7 @@ import { createVNode } from '@vue/runtime-core' export function renderSlot( slots: Slots, name: string, - props: Data = {}, + props: Data & VNodeProps = {}, // this is not a user-facing function, so the fallback is always generated by // the compiler and guaranteed to be a function returning an array fallback?: () => VNodeArrayChildren, diff --git a/packages/runtime-core/src/vnode.ts b/packages/runtime-core/src/vnode.ts index a03fc411527..a9568fe060e 100644 --- a/packages/runtime-core/src/vnode.ts +++ b/packages/runtime-core/src/vnode.ts @@ -286,12 +286,12 @@ function setupBlock(vnode: VNode) { * @private */ export function createElementBlock( - type: string, - props?: Record | null, - children?: any, + type: VNodeTypes | ClassComponent | typeof NULL_DYNAMIC_COMPONENT, + props?: (Data & VNodeProps) | null, + children?: unknown, patchFlag?: number, - dynamicProps?: string[], - shapeFlag?: number + dynamicProps?: string[] | null, + shapeFlag?: number | ShapeFlags ) { return setupBlock( createBaseVNode( @@ -314,11 +314,11 @@ export function createElementBlock( * @private */ export function createBlock( - type: VNodeTypes | ClassComponent, - props?: Record | null, - children?: any, + type: VNodeTypes | ClassComponent | typeof NULL_DYNAMIC_COMPONENT, + props?: (Data & VNodeProps) | null, + children?: unknown, patchFlag?: number, - dynamicProps?: string[] + dynamicProps?: string[] | null ): VNode { return setupBlock( createVNode(