Skip to content

Commit 3cfc558

Browse files
committed
fix: typecheck
1 parent 0a9ccaa commit 3cfc558

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/utilities/core/src/functions.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { isFunction } from "./guard"
2+
13
export type MaybeFunction<T> = T | (() => T)
24

35
export type Nullable<T> = T | null | undefined
@@ -39,7 +41,7 @@ export function match<V extends string | number = string, R = unknown>(
3941
): R {
4042
if (key in record) {
4143
const fn = record[key]
42-
return typeof fn === "function" ? fn(...args) : fn
44+
return isFunction(fn) ? fn(...args) : (fn as any)
4345
}
4446

4547
const error = new Error(`No matching key: ${JSON.stringify(key)} in ${JSON.stringify(Object.keys(record))}`)

0 commit comments

Comments
 (0)