Type guard to check if a Result is an error.
The type of the successful value
The type of the error
The Result to check
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} Copy
const errorResult = err(new Error("Failed"))if (isErr(errorResult)) { console.error(errorResult.error) // TypeScript knows this is Err}
Type guard to check if a Result is an error.