The type of the value contained in the Option
Readonly
_tag: "Some" | "None"Tag identifying if this is a Some or None variant
Whether this Option contains no value
The number of elements in this Option (0 or 1)
Readonly
value: T | undefinedThe contained value (undefined for None)
Checks if this Option contains the specified value
The value to check for
true if this Option contains the value, false otherwise
Maps the value using an async function that returns an Option
Promise of the result of applying f to the contained value, or None if this Option is None
Pattern matches over the Option, applying onNone if None and onSome if Some
Function to apply if the Option is None
Function to apply if the Option has a value
The result of applying the appropriate function
Left-associative fold using the provided zero value and operation
Zero/identity value
A function that takes an operation to apply
Right-associative fold using the provided zero value and operation
Zero/identity value
A function that takes an operation to apply
Returns the contained value or throws a specified error if None
The error to throw if this Option is None
The contained value
Applies a binary operator to a start value and the contained value
The binary operator
The result of the reduction
Applies a binary operator to the contained value and a start value
The binary operator
The result of the reduction
Returns a string representation of this Option
A string representation
Returns a simple object representation of this Option
An object with _tag and value properties
The Option type represents a value that may or may not exist. It's used to handle potentially null or undefined values in a type-safe way.