UNPKG

cmd-ts

Version:

> 💻 A type-driven command line argument parser, with awesome error reporting 🤤

17 lines (16 loc) • 803 B
export declare type FromFn<A, B> = (input: A) => Promise<B>; /** A safe conversion from type A to type B */ export declare type From<A, B> = { /** * Convert `input` safely and asynchronously into an output. */ from: FromFn<A, B>; }; /** The output of a conversion type or function */ export declare type OutputOf<F extends From<any, any> | FromFn<any, any>> = F extends From<any, infer Output> ? Output : F extends FromFn<any, infer Output> ? Output : never; /** The input of a conversion type or function */ export declare type InputOf<F extends From<any, any> | FromFn<any, any>> = F extends From<infer Input, any> ? Input : F extends FromFn<infer Input, any> ? Input : never; /** * A type "conversion" from any type to itself */ export declare function identity<T>(): From<T, T>;