- asMaybe<T, N>(x: T, nothingValue?: N): [N] extends [T] ? IsEqual<T, N> extends true ? Nothing : Maybe<Exclude<T, N>> : Exclude<T, N>
Type parameters
Parameters
x: T
optionalnothingValue: N
Returns [N] extends [T] ? IsEqual<T, N> extends true ? Nothing : Maybe<Exclude<T, N>> : Exclude<T, N>
Creates a Maybe from the given value.
Example