method Result.prototype.isErr
Result.prototype.isErr(): this is Result<never, E>

Type guard to check if this Result is Err.

Examples

Example 1

const result = Result.err(new ValidationError("Failed"));
if (result.isErr()) {
  // TypeScript knows result is Err here
}

Return Type

this is Result<never, E>

True if this result is Err, false otherwise

Usage

import { Result } from "result/mod.ts";