ParserOptions

type

Extra options for the parser

Properties

NameTypeDescription
extraParsers?Record<string, Parser<any>>Can be used to implement custom parser types.
lenient?booleanWhen set to true, suppresses parse-time errors such as missing values for options (e.g. `--port` with no following token). Instead of throwing, the option is silently skipped. Useful for completion resolution where the argv is intentionally incomplete.
strict?booleanWhen set to true, throws a validation error if any unmatched arguments are encountered. Unmatched arguments are those that don't match any configured option or positional argument.
stripDashed?booleanWhen set to true (default), automatically allows options to be used with both camelCase and dashed formats. For example, an option named "someFlag" will accept both --someFlag and --some-flag. Set to false to disable this automatic aliasing behavior.
unmatchedParser?(arg: string, tokens: string[], parser: ArgvParser<T>) => booleanCan be used to implement custom handling for unmatched arguments. This runs before positional arguments would be matched, allowing it to intercept values that would otherwise be consumed as positionals (e.g. for subcommand parsing).
validate?booleanWhen set to false, skips validation (required checks, choices, conflicts, etc.) while still normalizing options (defaults, env vars, coercion). Useful for best-effort discovery parsing. Defaults to true.