SDK
API Documentation
core
variables
Option

Variable: Option

Option: object

Type declaration

None()

None: <T>() => Option<T>

Create an Option that contains no value.

Type Parameters

Type ParameterDescription
TThe type of the value to not contain.

Returns

Option<T>

Value()

Value: <T>(value) => Option<T>

Create an Option that contains a value.

Type Parameters

Type ParameterDescription
TThe type of the value to contain.

Parameters

ParameterTypeDescription
valueTThe value to contain.

Returns

Option<T>

isSome()

isSome: <T>(option) => option is Object

Type Parameters

Type ParameterDescription
TThe type of the value to contain.

Parameters

ParameterType
optionOption<T>

Returns

option is Object

true if the Option contains a value, otherwise false.

unwrap()

unwrap: <T>(option) => T

Type Parameters

Type ParameterDescription
TThe type of the value to contain.

Parameters

ParameterType
optionOption<T>

Returns

T

The value contained in the Option.

unwrapOr()

unwrapOr: <T>(option, defaultValue?) => undefined | T

Type Parameters

Type ParameterDescription
TThe type of the value to contain.

Parameters

ParameterType
optionOption<T>
defaultValue?T

Returns

undefined | T

The value contained in the Option, or the default value if the Option is None.

unwrapOrThrow()

unwrapOrThrow: <T>(option, error) => T

Type Parameters

Type ParameterDescription
TThe type of the value to contain.

Parameters

ParameterType
optionOption<T>
errorError

Returns

T

The value contained in the Option.

Defined in

lib/types.ts:9 (opens in a new tab)