Type guard to check if a Result is successful.
The type of the successful value
The type of the error
The Result to check
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>} Copy
const result = ok("hello world")if (isOk(result)) { console.log(result.value) // TypeScript knows this is Ok<T>}
Type guard to check if a Result is successful.