From 2c946507afeae7f19f042b33ad77f99989e7f3b5 Mon Sep 17 00:00:00 2001 From: zhangenming <282126346@qq.com> Date: Wed, 22 Jan 2025 10:37:05 +0800 Subject: [PATCH 1/2] improvement createHook type --- packages/runtime-core/src/apiLifecycle.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/runtime-core/src/apiLifecycle.ts b/packages/runtime-core/src/apiLifecycle.ts index b79a6d38a06..a2bd5fd88ae 100644 --- a/packages/runtime-core/src/apiLifecycle.ts +++ b/packages/runtime-core/src/apiLifecycle.ts @@ -64,7 +64,7 @@ export function injectHook( } const createHook = - any>(lifecycle: LifecycleHooks) => + void>(lifecycle: LifecycleHooks) => ( hook: T, target: ComponentInternalInstance | null = currentInstance, @@ -77,7 +77,7 @@ const createHook = injectHook(lifecycle, (...args: unknown[]) => hook(...args), target) } } -type CreateHook = ( +type CreateHook void> = ( hook: T, target?: ComponentInternalInstance | null, ) => void From 977dee20d4a70ed0c77b880e5105481886b1e913 Mon Sep 17 00:00:00 2001 From: zhangenming <282126346@qq.com> Date: Mon, 2 Jun 2025 09:02:18 +0800 Subject: [PATCH 2/2] Update apiLifecycle.ts --- packages/runtime-core/src/apiLifecycle.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/runtime-core/src/apiLifecycle.ts b/packages/runtime-core/src/apiLifecycle.ts index a2bd5fd88ae..9427d4c92f3 100644 --- a/packages/runtime-core/src/apiLifecycle.ts +++ b/packages/runtime-core/src/apiLifecycle.ts @@ -64,7 +64,7 @@ export function injectHook( } const createHook = - void>(lifecycle: LifecycleHooks) => + any>(lifecycle: LifecycleHooks) => ( hook: T, target: ComponentInternalInstance | null = currentInstance, @@ -77,7 +77,7 @@ const createHook = injectHook(lifecycle, (...args: unknown[]) => hook(...args), target) } } -type CreateHook void> = ( +type CreateHook any> = ( hook: T, target?: ComponentInternalInstance | null, ) => void