Interface ParseArgsOptionConfig

This is copied in from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/e858f398c44ef759a64dd49854fd3470e6b65731/types/node/util.d.ts#L1254

The original types there do not export enough of the intermediate types so that the new properties can be grafted on more easily than this.

interface ParseArgsOptionConfig {
    argumentName?: string;
    choices?: string[];
    default?:
        | string
        | boolean
        | boolean[]
        | string[];
    description?: string;
    multiple?: boolean;
    short?: string;
    type: "string" | "boolean";
}

Properties

argumentName?: string

If the type is 'string, what should the argument be called in the documentation?

minus-h

choices?: string[]

If type is string, and choices is specified, the value must be one of these choices.

minus-h

default?:
    | string
    | boolean
    | boolean[]
    | string[]

The default option value when it is not set by args. It must be of the same type as the the type property. When multiple is true, it must be an array.

v18.11.0

description?: string

Description of the argument, for generating help text.

minus-h

multiple?: boolean

Whether this option can be provided multiple times. If true, all values will be collected in an array. If false, values for the option are last-wins.

false.
short?: string

A single character alias for the option.

type: "string" | "boolean"

Type of argument.