Skip to content

Some

Defined in: src/util/Option.ts:29

A value is present.

T

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

Defined in: src/util/Option.ts:31

T

Some<T>

readonly _tag: "Some"

Defined in: src/util/Option.ts:30


readonly value: T

Defined in: src/util/Option.ts:31

get isEmpty(): boolean

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

boolean


get nonEmpty(): boolean

Defined in: src/util/Option.ts:74

boolean


get size(): 0 | 1

Defined in: src/util/Option.ts:75

0 | 1

contains(other): boolean

Defined in: src/util/Option.ts:65

true iff present and the value equals other (SameValue comparison).

T

boolean


exists(pred): boolean

Defined in: src/util/Option.ts:59

true iff present and pred(value) is truthy.

(value) => boolean

boolean


filter(pred): Option<T>

Defined in: src/util/Option.ts:49

Keep if predicate holds, else None.

(value) => boolean

Option<T>


filterNot(pred): Option<T>

Defined in: src/util/Option.ts:54

Drop if predicate holds, else keep. Mirror of filter.

(value) => boolean

Option<T>


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

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

Map to another Option; stays Some if result is Some, else becomes None.

U

(value) => Option<U>

Option<U>


fold<U>(_onNone, onSome): U

Defined in: src/util/Option.ts:68

Collapse to a single value: onSome is called with the present value.

U

() => U

(value) => U

U


forall(pred): boolean

Defined in: src/util/Option.ts:62

true iff absent OR pred(value) is truthy.

(value) => boolean

boolean


forEach(f): void

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

Run side-effect if present.

(value) => void

void


getOrElse<U>(_fallback): T

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

Present → the value; fallback ignored.

U

U | (() => U)

T


isNone(): this is None

Defined in: src/util/Option.ts:72

this is None


isSome(): this is Some<T>

Defined in: src/util/Option.ts:71

Type-narrowing check.

this is Some<T>


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

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

Map the inner value; stays Some.

U

(value) => U

Option<U>


orElse<U>(_alternative): Option<T>

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

Present → this; alternative ignored.

U

Option<U> | (() => Option<U>)

Option<T>


toArray(): T[]

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

Materialise into a zero-or-one-element array.

T[]


toNullable(): T

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

Bridge back to nullable — useful at serialization/API boundaries.

T