argparse-ts
Version:
Modern CLI arguments parser for node.js
40 lines (39 loc) • 1.2 kB
TypeScript
import type { ArgConfigExtended, ValueCasterInterface } from "../types";
/**
* Creates a value caster based on the provided argument configuration.
*
* @param argConfig - The extended configuration for the argument to cast.
*
* @returns A value caster that can be used to cast the argument value.
*
* @category Utils
* @category Cast
*/
export declare function createValueCaster(argConfig: ArgConfigExtended): BaseValueCaster<unknown>;
/**
* Base value caster.
*
* @category Cast
*/
declare abstract class BaseValueCaster<T> implements ValueCasterInterface<T> {
/**
* The extended configuration for the argument to cast.
*/
protected argConfig: ArgConfigExtended;
/**
* Constructs a base value caster with the provided argument configuration.
*
* @param config - The extended configuration for the argument to cast.
*/
constructor(config: ArgConfigExtended);
/**
* Casts the argument value to the expected type.
*
* @param value - The value to cast.
* @param isset - Whether the value is set.
*
* @returns The casted value.
*/
cast(value: string[], isset: boolean): T | undefined;
}
export {};