콘텐츠로 이동
한국어

Success

이 콘텐츠는 아직 번역되지 않았습니다.

Defined in: src/util/Try.ts:32

The computation returned a value.

T = unknown

new Success<T>(value): Success<T>

Defined in: src/util/Try.ts:34

T

Success<T>

readonly _tag: "Success"

Defined in: src/util/Try.ts:33


readonly value: T

Defined in: src/util/Try.ts:34

filter(pred, makeError?): Try<T>

Defined in: src/util/Try.ts:64

Keep if predicate holds; else Failure with a FilterError.

(value) => boolean

(value) => Error

Try<T>


flatMap<U>(f): Try<U>

Defined in: src/util/Try.ts:52

Chain to another Try. A thrown mapper becomes Failure.

U

(value) => Try<U>

Try<U>


fold<U>(_onFailure, onSuccess): U

Defined in: src/util/Try.ts:73

Collapse both cases into one value.

U

(err) => U

(value) => U

U


forEach(f): void

Defined in: src/util/Try.ts:78

Run a side-effect on the value.

(value) => void

void


get(): T

Defined in: src/util/Try.ts:81

Convert to a “classic” value — the inner value.

T


getOrElse<U>(_fallback): T

Defined in: src/util/Try.ts:40

Always Success; fallback ignored.

U

U | ((err) => U)

T


isFailure(): this is Failure

Defined in: src/util/Try.ts:37

this is Failure


isSuccess(): this is Success<T>

Defined in: src/util/Try.ts:36

this is Success<T>


map<U>(f): Try<U>

Defined in: src/util/Try.ts:46

Map the inner value. A thrown mapper turns this into a Failure.

U

(value) => U

Try<U>


orElse<U>(_alt): Try<T>

Defined in: src/util/Try.ts:43

Always Success; alternative ignored.

U

Try<U> | (() => Try<U>)

Try<T>


recover<U>(_f): Try<T | U>

Defined in: src/util/Try.ts:58

Always Success — no recovery runs.

U

(err) => U | null

Try<T | U>


recoverWith<U>(_f): Try<T | U>

Defined in: src/util/Try.ts:61

Always Success — no recovery runs.

U

(err) => Try<U>

Try<T | U>


toError(): Error | null

Defined in: src/util/Try.ts:87

Fresh copy of the error, or null.

Error | null


toNullable(): T | null

Defined in: src/util/Try.ts:84

Convert to an Option-like shape (null on Failure).

T | null