uft
    Preparing search index...

    Function isRetryOK

    • Checks if a RetryResult was successful, i.e. if the ok property is defined.

      Parameters

      Returns result is { ok: unknown }

      true if the result was successful, false otherwise.

      const result: RetryResult<string>
      if (isRetryOK(result)) {
      console.log(result.ok)
      } else {
      console.error(result.err)
      }
      const result: RetryResult<number>
      if (isRetryOK(result)) {
      result.ok // type: number
      } else {
      result.err // type: unknown (probably Error)
      }

      // or
      if (!isRetryOK(result)) {
      result.err // type: unknown (probably Error)
      } else {
      result.ok // type: number
      }