@jenova-marie/ts-rust-result - v2.2.18
    Preparing search index...

    Function isErr

    • Type guard to check if a Result is an error.

      Type Parameters

      • T

        The type of the successful value

      • E = Error

        The type of the error

      Parameters

      • result: Result<T, E>

        The Result to check

      Returns result is Err<E>

      True if the Result is an error (Err), false otherwise

      const errorResult = err(new Error("Failed"))
      if (isErr(errorResult)) {
      console.error(errorResult.error) // TypeScript knows this is Err
      }