From eb97b539c9720c34a82870f3a78a775822fdf5c9 Mon Sep 17 00:00:00 2001 From: Yuichiro Yamashita Date: Thu, 23 Feb 2023 17:45:51 +0900 Subject: [PATCH] enhance type --- src/runtime/internal/lifecycle.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/internal/lifecycle.ts b/src/runtime/internal/lifecycle.ts index 9717509190..258f8b651d 100644 --- a/src/runtime/internal/lifecycle.ts +++ b/src/runtime/internal/lifecycle.ts @@ -31,7 +31,7 @@ export function beforeUpdate(fn: () => any) { * * https://svelte.dev/docs#run-time-svelte-onmount */ -export function onMount(fn: (() => () => void) | (() => void | Promise)) { +export function onMount(fn: (() => T extends Promise ? T : T extends Promise ? never : T)): void { get_current_component().$$.on_mount.push(fn); }