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

    Function isOk

    • Type guard to check if a Result is successful.

      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 Ok<T>

      True if the Result is successful (Ok), false otherwise

      const result = ok("hello world")
      if (isOk(result)) {
      console.log(result.value) // TypeScript knows this is Ok<T>
      }