Variable: Option
Option:
object
Type declaration
None()
None: <
T
>() =>Option
<T
>
Create an Option that contains no value.
Type Parameters
Type Parameter | Description |
---|---|
T | The 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 Parameter | Description |
---|---|
T | The type of the value to contain. |
Parameters
Parameter | Type | Description |
---|---|---|
value | T | The value to contain. |
Returns
Option
<T
>
isSome()
isSome: <
T
>(option
) =>option is Object
Type Parameters
Type Parameter | Description |
---|---|
T | The type of the value to contain. |
Parameters
Parameter | Type |
---|---|
option | Option <T > |
Returns
option is Object
true if the Option contains a value, otherwise false.
unwrap()
unwrap: <
T
>(option
) =>T
Type Parameters
Type Parameter | Description |
---|---|
T | The type of the value to contain. |
Parameters
Parameter | Type |
---|---|
option | Option <T > |
Returns
T
The value contained in the Option.
unwrapOr()
unwrapOr: <
T
>(option
,defaultValue
?) =>undefined
|T
Type Parameters
Type Parameter | Description |
---|---|
T | The type of the value to contain. |
Parameters
Parameter | Type |
---|---|
option | Option <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 Parameter | Description |
---|---|
T | The type of the value to contain. |
Parameters
Parameter | Type |
---|---|
option | Option <T > |
error | Error |
Returns
T
The value contained in the Option.