Skip to content

Commit bcf9a87

Browse files
committed
Add isPromiseLike helper
1 parent 578d45f commit bcf9a87

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/lib.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,3 +564,8 @@ export function coerceError(err: unknown): Error & { code?: unknown } {
564564
return new Error(message, { cause: err });
565565
}
566566
}
567+
568+
export function isPromiseLike<T>(v: PromiseLike<T> | T): v is PromiseLike<T> {
569+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
570+
return v != null && typeof (v as any).then === "function";
571+
}

0 commit comments

Comments
 (0)