Skip to main content

Function: makeComposableOption()

makeComposableOption<TKey, TOptionConfig>(name, config): <T>(argv) => ArgvParser<T & { [key in string]: UndefinedIfRequiredAndNoDefault<TOptionConfig, InferTChoice<TOptionConfig> extends [never] ? TOptionConfig["coerce"] extends Function ? ReturnType<any[any]> : Object[TOptionConfig["type"]] : InferTChoice<TOptionConfig>> }>

A composition helper to be used with chain.

Type Parameters

TKey extends string

TOptionConfig extends OptionConfig

Parameters

name: TKey

The name of the option to add

config: TOptionConfig

The configuration for the option

Returns

Function

A unary function that adds an option to an ArgvParser.

Type Parameters

T extends object

Parameters

argv: ArgvParser<T>

Returns

ArgvParser<T & { [key in string]: UndefinedIfRequiredAndNoDefault<TOptionConfig, InferTChoice<TOptionConfig> extends [never] ? TOptionConfig["coerce"] extends Function ? ReturnType<any[any]> : Object[TOptionConfig["type"]] : InferTChoice<TOptionConfig>> }>

Defined in

packages/parser/src/lib/utils/chain.ts:608