cmd-ts
Version:
> 💻 A type-driven command line argument parser, with awesome error reporting 🤤
24 lines (23 loc) • 781 B
TypeScript
import { Type, InputOf, OutputOf } from './type';
/**
* A number type to be used with `option`
*
* Throws an error when the provided string is not a number
*/
export declare const number: Type<string, number>;
/**
* A string type to be used with `option`.
*/
export declare const string: Type<string, string>;
/**
* A boolean type to be used with `flag`.
*/
export declare const boolean: Type<boolean, boolean>;
/**
* Makes any type optional, by defaulting to `undefined`.
*/
export declare function optional<T extends Type<any, any>>(t: T): Type<InputOf<T>, OutputOf<T> | undefined>;
/**
* Transforms any type into an array, useful for `multioption` and `multiflag`.
*/
export declare function array<T extends Type<any, any>>(t: T): Type<InputOf<T>[], OutputOf<T>[]>;