UNPKG

option-t

Version:

A toolkit of Nullable/Option/Result type implementation in ECMAScript. Their APIs are inspired by Rust's `Option<T>` and `Result<T, E>`.

12 lines (11 loc) 649 B
import type { AsyncTransformFn } from '../../internal/function.js'; import { type Undefinable, type NotUndefined } from '../core/undefinable.js'; /** * Return the result of _transformer_ with using _input_ as an argument for it if _input_ is not `undefined`, * Otherwise, return `undefined`. * * * `U` must not be `Undefinable<*>`. * * If you'd like return `Undefinable<*>` as `U`, use `andThen()`. * * If the result of _transformer_ is `undefined`, this throw an `Error`. */ export declare function mapAsyncForUndefinable<T, U>(input: Undefinable<T>, transformer: AsyncTransformFn<T, NotUndefined<U>>): Promise<Undefinable<U>>;