type FlagArgs = Record; type FlagSpec = { consume( argv: readonly string[], index: number, args: T, ): { flag?: string; nextIndex: number; repeatable?: boolean; apply(target?: T): void; } | null; }; export function readFlagValue(args: readonly string[], name: string): string | undefined; export function stripLeadingPackageManagerSeparator(argv: string[]): string[]; export function stringFlag( flag: string, key: string, options?: { allowEmpty?: boolean; allowInline?: boolean; missingValueMessage?: string; rejectShortOptions?: boolean; repeatable?: boolean; transform?: (value: string) => unknown; }, ): FlagSpec; export function stringListFlag( flag: string, key: string, options?: { allowEmpty?: boolean; allowInline?: boolean; missingValueMessage?: string; rejectShortOptions?: boolean; }, ): FlagSpec; export function intFlag( flag: string, key: string, options?: { min?: number }, ): FlagSpec; export function booleanFlag( flag: string, key: string, value?: unknown, options?: { repeatable?: boolean }, ): FlagSpec; export function parseFlagArgs( argv: readonly string[], args: T, specs: readonly FlagSpec[], options?: { allowUnknownOptions?: boolean; duplicateOptionMessage?: (flag: string) => string; ignoreDoubleDash?: boolean; onUnhandledArg?: (arg: string, args: T) => "handled" | void; }, ): T;