@nevware21/ts-utils
    Preparing search index...

    Function isAsyncGenerator

    • Checks if the provided value is an AsyncGeneratorFunction

      Parameters

      • value: any

        Value to be checked

      Returns value is AsyncGeneratorFunction

      True if the value is an AsyncGeneratorFunction, false otherwise

      0.12.3

      This function checks if the provided value is an AsyncGeneratorFunction, which is a special type of function that returns an AsyncGenerator and can be used with the await keyword. Note that this function does not check if the function is a generator or an async function. And when using TypeScript and targetting earlier versions of JavaScript, the type of the function may NOT be AsyncGeneratorFunction and instead be a regular function.

      async function* asyncGenFn() { }
      isAsyncGenerator(asyncGenFn); // true
      isAsyncGenerator(function() {}); // false
      isAsyncGenerator(async function() {}); // false
      isAsyncGenerator(function* () {}); // false
      isAsyncGenerator(null); // false
      isAsyncGenerator(undefined); // false