From be4c22022867f2c2a41752459b87aa678debc234 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Thu, 19 Sep 2024 20:43:49 +0200 Subject: [PATCH] [Refactoring] Better typings for `safeExec` --- src/util/safeExec.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/util/safeExec.ts b/src/util/safeExec.ts index a03fe59d2..50369529f 100644 --- a/src/util/safeExec.ts +++ b/src/util/safeExec.ts @@ -3,7 +3,11 @@ import { handleError } from './handleError'; const SAFE_EXEC_ENABLED = !DEBUG_MORE; -export default function safeExec(cb: Function, rescue?: (err: Error) => void, always?: NoneToVoidFunction) { +export default function safeExec( + cb: F, + rescue?: (err: Error) => void, + always?: NoneToVoidFunction, +): ReturnType | undefined { if (!SAFE_EXEC_ENABLED) { return cb(); }