Skip to content

isAsync

It detects if a function is asynchronous.

Types

IsAsyncProps

  • @template T - The argument tuple type of the function, when fn is callable.
  • @template E - The return or resolved value type.

Parameters accepted by isAsync.

PropertyTypeRequiredDescription
fnE \| Promise<E> \| ((...args: T) => E \| Promise<E>)The value to inspect. Accepts: - A plain value of type E — considered synchronous. - A Promise&lt;E&gt; — considered asynchronous. - A function (...args: T) =&gt; E | Promise&lt;E&gt; — considered asynchronous if the function is declared async or its toString() representation contains the async keyword.

Released under the MIT License.