Skip to content

Commit 6642102

Browse files
Akryumyyx990803
authored andcommitted
fix(types): onErrorCaptured err default type + generic type
1 parent 1403bce commit 6642102

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/runtime-core/src/apiLifecycle.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,16 @@ export const onRenderTracked = createHook<DebuggerHook>(
8484
LifecycleHooks.RENDER_TRACKED
8585
)
8686

87-
export type ErrorCapturedHook = (
88-
err: unknown,
87+
export type ErrorCapturedHook<TError = unknown> = (
88+
err: TError,
8989
instance: ComponentPublicInstance | null,
9090
info: string
9191
) => boolean | void
9292

93-
export const onErrorCaptured = (
94-
hook: ErrorCapturedHook,
93+
export function onErrorCaptured<TError = Error>(
94+
hook: ErrorCapturedHook<TError>,
9595
target: ComponentInternalInstance | null = currentInstance
96-
) => {
96+
) {
9797
injectHook(LifecycleHooks.ERROR_CAPTURED, hook, target)
9898
}
9999

0 commit comments

Comments
 (0)