type alias Caught

What the boundary hands back: the value, or whatever was caught — unknown, honestly, because a catch binding is exactly as untrustworthy.

import { tryCatch } from './try.ts';

const parsed = tryCatch(JSON.parse, '{"n":1}');
if (parsed.ok) parsed.value; // narrowed; the else branch holds the caught unknown

Type Parameters

E = unknown

Definition

Ok<T> | Err<E>

Usage

import { type Caught } from "lib/result/try.ts";