Skip to content

TaskResult

TaskResult<E, A> = Task<Result<E, A>>

Defined in: Core/TaskResult.ts:17

A Task that can fail with an error of type E or succeed with a value of type A. Combines async operations with typed error handling.

E

A

const fetchUser = (id: string): TaskResult<Error, User> =>
  TaskResult.tryCatch(
    () => fetch(`/users/${id}`).then(r => r.json()),
    (e) => new Error(`Failed to fetch user: ${e}`)
  );