Module: Either
Type Aliases
Either
Ƭ Either<LeftValue
, RightValue
>: Left
<LeftValue
> | Right
<RightValue
>
Type constructor for Either
.
Can be either Right
of the value provided,
or Left
of the error thrown.
Type parameters
Name |
---|
LeftValue |
RightValue |
Left
Ƭ Left<Value
>: Object
Type constructor for Left
.
Describes the special object with one property, represented as unique symbol
key, holding the provided value type.
Type parameters
Name |
---|
Value |
Type declaration
Name | Type |
---|---|
[lid] | Value |
Right
Ƭ Right<Value
>: Object
Type constructor for Right
.
Describes the special object with one property, represented as unique symbol
key, holding the provided value type.
Type parameters
Name |
---|
Value |
Type declaration
Name | Type |
---|---|
[rid] | Value |
Variables
lid
• Const
lid: typeof lid
Internal unique identifier for Left
.
rid
• Const
rid: typeof rid
Internal unique identifier for Right
.
Functions
either
▸ either<LeftValue
, RightValue
>(value
): Promise
<Either
<LeftValue
, RightValue
>>
Type constructor for Either
.
Creates either Right
of the value provided,
or Left
of the error thrown.
Type parameters
Name |
---|
LeftValue |
RightValue |
Parameters
Name | Type |
---|---|
value | () => Promise <RightValue > |
Returns
Promise
<Either
<LeftValue
, RightValue
>>
eitherSync
▸ eitherSync<LeftValue
, RightValue
>(value
): Either
<LeftValue
, RightValue
>
Type constructor for Either
.
Creates either Right
of the value provided,
or Left
of the thrown error.
Type parameters
Name |
---|
LeftValue |
RightValue |
Parameters
Name | Type |
---|---|
value | () => RightValue |
Returns
Either
<LeftValue
, RightValue
>
left
▸ left<Value
>(value?
): Left
<Value
>
Constructor function for Left
.
Creates the special object with one property, represented as unique symbol
key, holding the provided value.
Type parameters
Name | Type |
---|---|
Value | undefined |
Parameters
Name | Type |
---|---|
value? | Value |
Returns
Left
<Value
>
right
▸ right<Value
>(value?
): Right
<Value
>
Constructor function for Right
.
Creates the special object with one property, represented as unique symbol
key, holding the provided value.
Type parameters
Name | Type |
---|---|
Value | undefined |
Parameters
Name | Type |
---|---|
value? | Value |
Returns
Right
<Value
>