AsyncMaybe<T> is an alias for
Promise<Maybe<T>>. The companion AsyncMaybe:namespace namespace
provides utilities for working with the AsyncMaybe<T> type.
To accommodate promise-like values, this module also provides the
AsyncMaybeLike<T> type as an alias for
PromiseLike<Maybe<T>>.
Optional values.
Remarks
Maybe<T>
is a type that represents an optional value. It is represented by two variants:Nothing
andJust<T>
.Nothing
is the absentMaybe
and contains no value.Just<T>
is a presentMaybe
and contains a value of typeT
.The companion
Maybe:namespace
namespace provides utilities for working with theMaybe<T>
type.Common uses for
Maybe
include:Nothing
is returned on failureUsing
Maybe
with promisesAsyncMaybe<T>
is an alias forPromise<Maybe<T>>
. The companionAsyncMaybe:namespace
namespace provides utilities for working with theAsyncMaybe<T>
type.To accommodate promise-like values, this module also provides the
AsyncMaybeLike<T>
type as an alias forPromiseLike<Maybe<T>>
.Importing from this module
The types and namespaces from this module can be imported under the same aliases:
Or, they can be imported and aliased separately: