@webdeveric/utils
    Preparing search index...
    • Assert that input is a fulfilled Promise result.

      Type Parameters

      • T

      Parameters

      • input: unknown
      • error: string | Error = 'input is not a promise fulfilled result'

      Returns asserts input is PromiseFulfilledResult<T>

      const [result] = await Promise.allSettled([Promise.resolve(42)]);

      assertIsPromiseFulfilledResult<number>(result); // does not throw
      assertIsPromiseFulfilledResult({ status: 'rejected' }); // throws TypeError: input is not a promise fulfilled result