return value === killBehavior
}
+type AsyncFunctionType<A extends unknown[], R> = (...args: A) => PromiseLike<R>
+
/**
* Detects whether the given value is an asynchronous function or not.
* @param fn - Unknown value.
*/
export const isAsyncFunction = (
fn: unknown
-): fn is (...args: unknown[]) => Promise<unknown> => {
- return typeof fn === 'function' && fn.constructor.name === 'AsyncFunction'
+): fn is AsyncFunctionType<unknown[], unknown> => {
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
+ return fn?.constructor === (async () => {}).constructor
}
/**