diff --git a/packages/runtime-core/src/apiCreateApp.ts b/packages/runtime-core/src/apiCreateApp.ts index 971b406cf01..c5ac9d68a52 100644 --- a/packages/runtime-core/src/apiCreateApp.ts +++ b/packages/runtime-core/src/apiCreateApp.ts @@ -16,7 +16,7 @@ import { ComponentPublicInstance } from './componentPublicInstance' import { Directive, validateDirectiveName } from './directives' -import { RendererElement, RootRenderFunction } from './renderer' +import { RootRenderFunction } from './renderer' import { InjectionKey } from './apiInject' import { warn } from './warning' import { createVNode, cloneVNode, VNode } from './vnode' @@ -196,7 +196,7 @@ export type CreateAppFunction = ( let uid = 0 -export function createAppAPI( +export function createAppAPI( render: RootRenderFunction, hydrate?: RootHydrateFunction ): CreateAppFunction { diff --git a/packages/runtime-core/src/directives.ts b/packages/runtime-core/src/directives.ts index eb80cd495f6..18c3352b002 100644 --- a/packages/runtime-core/src/directives.ts +++ b/packages/runtime-core/src/directives.ts @@ -21,7 +21,6 @@ import { ComponentPublicInstance } from './componentPublicInstance' import { mapCompatDirectiveHook } from './compat/customDirective' import { pauseTracking, resetTracking } from '@vue/reactivity' import { traverse } from './apiWatch' -import { RendererElement } from './renderer' export interface DirectiveBinding { instance: ComponentPublicInstance | null @@ -32,11 +31,7 @@ export interface DirectiveBinding { dir: ObjectDirective } -export type DirectiveHook< - T extends RendererElement = any, - Prev = VNode | null, - V = any -> = ( +export type DirectiveHook | null, V = any> = ( el: T, binding: DirectiveBinding, vnode: VNode, @@ -48,7 +43,7 @@ export type SSRDirectiveHook = ( vnode: VNode ) => Data | undefined -export interface ObjectDirective { +export interface ObjectDirective { created?: DirectiveHook beforeMount?: DirectiveHook mounted?: DirectiveHook @@ -60,12 +55,9 @@ export interface ObjectDirective { deep?: boolean } -export type FunctionDirective< - T extends RendererElement = any, - V = any -> = DirectiveHook +export type FunctionDirective = DirectiveHook -export type Directive = +export type Directive = | ObjectDirective | FunctionDirective diff --git a/packages/runtime-core/src/renderer.ts b/packages/runtime-core/src/renderer.ts index 3ab81cbf3ba..383e17fb0f5 100644 --- a/packages/runtime-core/src/renderer.ts +++ b/packages/runtime-core/src/renderer.ts @@ -90,7 +90,7 @@ export type RootRenderFunction = ( export interface RendererOptions< HostNode = RendererNode, - HostElement extends RendererElement = RendererElement + HostElement = RendererElement > { patchProp( el: HostElement, @@ -145,7 +145,7 @@ export interface RendererElement extends RendererNode {} // to optimize bundle size. export interface RendererInternals< HostNode = RendererNode, - HostElement extends RendererElement = RendererElement + HostElement = RendererElement > { p: PatchFn um: UnmountFn @@ -295,7 +295,7 @@ export const queuePostRenderEffect = __FEATURE_SUSPENSE__ */ export function createRenderer< HostNode = RendererNode, - HostElement extends RendererElement = RendererElement + HostElement = RendererElement >(options: RendererOptions) { return baseCreateRenderer(options) } @@ -312,7 +312,7 @@ export function createHydrationRenderer( // overload 1: no hydration function baseCreateRenderer< HostNode = RendererNode, - HostElement extends RendererElement = RendererElement + HostElement = RendererElement >(options: RendererOptions): Renderer // overload 2: with hydration diff --git a/packages/runtime-core/src/vnode.ts b/packages/runtime-core/src/vnode.ts index 89242b94247..f8cf6652d31 100644 --- a/packages/runtime-core/src/vnode.ts +++ b/packages/runtime-core/src/vnode.ts @@ -133,7 +133,7 @@ export type VNodeNormalizedChildren = export interface VNode< HostNode = RendererNode, - HostElement extends RendererElement = RendererElement, + HostElement = RendererElement, ExtraProps = { [key: string]: any } > { /** @@ -613,7 +613,7 @@ export function guardReactiveProps(props: (Data & VNodeProps) | null) { : props } -export function cloneVNode( +export function cloneVNode( vnode: VNode, extraProps?: (Data & VNodeProps) | null, mergeRef = false