Skip to content
Myr

Add Command.options to TypeScript (#1827)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Make options and commands readonly to discourage direct manipulation.

authored by John Gee · committed by GitHub · parent e0f6173 · Browse files · 2 files+4 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: Cynthia <cynthia@cynthia.dev>
  • Co-authored-by: Marcelo Shima <marceloshima@gmail.com>
  • Co-authored-by: Dmitry Maganov <vonagam@gmail.com>

Diff stats

2 files+4 added−2 removed

  • other:+4 added−2 removed

2 files+4 added−2 removed

modified:typings/index.d.ts+2 added-1 removed
275 unmodified lines
276277export class Command {278 args: string[];279 processedArgs: any[];280 commands: Command[];280 readonly commands: readonly Command[];281 readonly options: readonly Option[];282 parent: Command | null;283284 constructor(name?: string);285
597 unmodified lines
modified:typings/index.test-d.ts+2 added-1 removed
26 unmodified lines
27// Command properties28expectType<string[]>(program.args);29// eslint-disable-next-line @typescript-eslint/no-explicit-any30expectType<any[]>(program.processedArgs);31expectType<commander.Command[]>(program.commands);31expectType<readonly commander.Command[]>(program.commands);32expectType<readonly commander.Option[]>(program.options);33expectType<commander.Command | null>(program.parent);3435// version36expectType<commander.Command>(program.version('1.2.3'));
439 unmodified lines