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) 603 B
import type { AsyncTransformFn } from '../../internal/function.js'; import { type Nullable, type NotNull } from '../core/nullable.js'; /** * Return the result of _transformer_ with using _input_ as an argument for it if _input_ is not `null`, * Otherwise, return `null`. * * * `U` must not be `Nullable<*>`. * * If you'd like return `Nullable<*>` as `U`, use `andThen()`. * * If the result of _transformer_ is `null`, this throw an `Error`. */ export declare function mapAsyncForNullable<T, U>(input: Nullable<T>, transformer: AsyncTransformFn<T, NotNull<U>>): Promise<Nullable<U>>;