python-archieve-projects/WechatBot/node_modules/cmd-ts/dist/esm/from.d.ts

17 lines
803 B
TypeScript

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>;