Some
Defined in: src/util/Option.ts:29
A value is present.
Type Parameters
Section titled “Type Parameters”T
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Some<
T>(value):Some<T>
Defined in: src/util/Option.ts:31
Parameters
Section titled “Parameters”T
Returns
Section titled “Returns”Some<T>
Properties
Section titled “Properties”
readonly_tag:"Some"
Defined in: src/util/Option.ts:30
readonlyvalue:T
Defined in: src/util/Option.ts:31
Accessors
Section titled “Accessors”isEmpty
Section titled “isEmpty”Get Signature
Section titled “Get Signature”get isEmpty():
boolean
Defined in: src/util/Option.ts:73
Returns
Section titled “Returns”boolean
nonEmpty
Section titled “nonEmpty”Get Signature
Section titled “Get Signature”get nonEmpty():
boolean
Defined in: src/util/Option.ts:74
Returns
Section titled “Returns”boolean
Get Signature
Section titled “Get Signature”get size():
0|1
Defined in: src/util/Option.ts:75
Returns
Section titled “Returns”0 | 1
Methods
Section titled “Methods”contains()
Section titled “contains()”contains(
other):boolean
Defined in: src/util/Option.ts:65
true iff present and the value equals other (SameValue comparison).
Parameters
Section titled “Parameters”T
Returns
Section titled “Returns”boolean
exists()
Section titled “exists()”exists(
pred):boolean
Defined in: src/util/Option.ts:59
true iff present and pred(value) is truthy.
Parameters
Section titled “Parameters”(value) => boolean
Returns
Section titled “Returns”boolean
filter()
Section titled “filter()”filter(
pred):Option<T>
Defined in: src/util/Option.ts:49
Keep if predicate holds, else None.
Parameters
Section titled “Parameters”(value) => boolean
Returns
Section titled “Returns”Option<T>
filterNot()
Section titled “filterNot()”filterNot(
pred):Option<T>
Defined in: src/util/Option.ts:54
Drop if predicate holds, else keep. Mirror of filter.
Parameters
Section titled “Parameters”(value) => boolean
Returns
Section titled “Returns”Option<T>
flatMap()
Section titled “flatMap()”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.
Type Parameters
Section titled “Type Parameters”U
Parameters
Section titled “Parameters”(value) => Option<U>
Returns
Section titled “Returns”Option<U>
fold()
Section titled “fold()”fold<
U>(_onNone,onSome):U
Defined in: src/util/Option.ts:68
Collapse to a single value: onSome is called with the present value.
Type Parameters
Section titled “Type Parameters”U
Parameters
Section titled “Parameters”_onNone
Section titled “_onNone”() => U
onSome
Section titled “onSome”(value) => U
Returns
Section titled “Returns”U
forall()
Section titled “forall()”forall(
pred):boolean
Defined in: src/util/Option.ts:62
true iff absent OR pred(value) is truthy.
Parameters
Section titled “Parameters”(value) => boolean
Returns
Section titled “Returns”boolean
forEach()
Section titled “forEach()”forEach(
f):void
Defined in: src/util/Option.ts:46
Run side-effect if present.
Parameters
Section titled “Parameters”(value) => void
Returns
Section titled “Returns”void
getOrElse()
Section titled “getOrElse()”getOrElse<
U>(_fallback):T
Defined in: src/util/Option.ts:40
Present → the value; fallback ignored.
Type Parameters
Section titled “Type Parameters”U
Parameters
Section titled “Parameters”_fallback
Section titled “_fallback”U | (() => U)
Returns
Section titled “Returns”T
isNone()
Section titled “isNone()”isNone():
this is None
Defined in: src/util/Option.ts:72
Returns
Section titled “Returns”this is None
isSome()
Section titled “isSome()”isSome():
this is Some<T>
Defined in: src/util/Option.ts:71
Type-narrowing check.
Returns
Section titled “Returns”this is Some<T>
map<
U>(f):Option<U>
Defined in: src/util/Option.ts:34
Map the inner value; stays Some.
Type Parameters
Section titled “Type Parameters”U
Parameters
Section titled “Parameters”(value) => U
Returns
Section titled “Returns”Option<U>
orElse()
Section titled “orElse()”orElse<
U>(_alternative):Option<T>
Defined in: src/util/Option.ts:43
Present → this; alternative ignored.
Type Parameters
Section titled “Type Parameters”U
Parameters
Section titled “Parameters”_alternative
Section titled “_alternative”Returns
Section titled “Returns”Option<T>
toArray()
Section titled “toArray()”toArray():
T[]
Defined in: src/util/Option.ts:78
Materialise into a zero-or-one-element array.
Returns
Section titled “Returns”T[]
toNullable()
Section titled “toNullable()”toNullable():
T
Defined in: src/util/Option.ts:81
Bridge back to nullable — useful at serialization/API boundaries.
Returns
Section titled “Returns”T