Skip to content
Myr

index.test-d.ts

This file

Path

typings/index.test-d.ts

787 lines · 24.7 KiB · TypeScript

Last changed by

Switching to esm-only (#2464)John Geebefore adoptionf4bd470

History of this file

Take it

1import * as commander from './index.js';2import { expectType } from 'tsd';34// We are not just checking return types here, we are also implicitly checking that the expected syntax is allowed.56const program: commander.Command = new commander.Command();7// @ts-expect-error Check that Command is strongly typed and does not allow arbitrary properties8// eslint-disable-next-line @typescript-eslint/no-unused-expressions9program.silly; // <-- Error, hurrah!1011// Check for exported global Command object12expectType<commander.Command>(commander.program);1314// Check export classes and functions exist15expectType<commander.Command>(new commander.Command());16expectType<commander.Command>(new commander.Command('name'));17expectType<commander.Option>(new commander.Option('-f'));18expectType<commander.CommanderError>(19  new commander.CommanderError(1, 'code', 'message'),20);21expectType<commander.InvalidArgumentError>(22  new commander.InvalidArgumentError('message'),23);24expectType<commander.InvalidArgumentError>(25  new commander.InvalidOptionArgumentError('message'),26);27expectType<commander.Command>(commander.createCommand());28expectType<commander.Option>(commander.createOption('--demo'));29expectType<commander.Argument>(commander.createArgument('<foo>'));3031// Command properties32expectType<string[]>(program.args);33// eslint-disable-next-line @typescript-eslint/no-explicit-any34expectType<any[]>(program.processedArgs);35expectType<readonly commander.Command[]>(program.commands);36expectType<readonly commander.Option[]>(program.options);37expectType<readonly commander.Argument[]>(program.registeredArguments);38expectType<commander.Command | null>(program.parent);3940// version41expectType<commander.Command>(program.version('1.2.3'));42expectType<commander.Command>(program.version('1.2.3', '-r,--revision'));43expectType<commander.Command>(44  program.version('1.2.3', '-r,--revision', 'show revision information'),45);46expectType<string | undefined>(program.version());4748// command (and CommandOptions)49expectType<commander.Command>(program.command('action'));50expectType<commander.Command>(51  program.command('action', { isDefault: true, hidden: true, noHelp: true }),52);53expectType<commander.Command>(program.command('exec', 'exec description'));54expectType<commander.Command>(55  program.command('exec', 'exec description', {56    isDefault: true,57    hidden: true,58    noHelp: true,59    executableFile: 'foo',60  }),61);6263// addCommand64expectType<commander.Command>(program.addCommand(new commander.Command('abc')));6566// argument67expectType<commander.Command>(program.argument('<value>'));68expectType<commander.Command>(program.argument('<value>', 'description'));69expectType<commander.Command>(70  program.argument('[value]', 'description', 'default'),71);72expectType<commander.Command>(73  program.argument('[value]', 'description', parseFloat),74);75expectType<commander.Command>(76  program.argument('[value]', 'description', parseFloat, 1.23),77);7879// arguments80expectType<commander.Command>(program.arguments('<cmd> [env]'));8182// addHelpCommand83expectType<commander.Command>(84  program.addHelpCommand(new commander.Command('assist')),85);86// Deprecated uses87expectType<commander.Command>(program.addHelpCommand());88expectType<commander.Command>(program.addHelpCommand(false));89expectType<commander.Command>(program.addHelpCommand(true));90expectType<commander.Command>(program.addHelpCommand('assist [cmd]'));91expectType<commander.Command>(92  program.addHelpCommand('assist [file]', 'display help'),93);9495// helpCommand96expectType<commander.Command>(program.helpCommand(false));97expectType<commander.Command>(program.helpCommand(true));98expectType<commander.Command>(program.helpCommand('assist [cmd]'));99expectType<commander.Command>(100  program.helpCommand('assist [file]', 'display help'),101);102103// exitOverride104expectType<commander.Command>(program.exitOverride());105expectType<commander.Command>(106  program.exitOverride((err): never => {107    return process.exit(err.exitCode);108  }),109);110expectType<commander.Command>(111  program.exitOverride((err): void => {112    if (err.code !== 'commander.executeSubCommandAsync') {113      throw err;114    } else {115      // Async callback from spawn events, not useful to throw.116    }117  }),118);119120// error121expectType<never>(program.error('Goodbye'));122expectType<never>(program.error('Goodbye', { code: 'my.error' }));123expectType<never>(program.error('Goodbye', { exitCode: 2 }));124expectType<never>(program.error('Goodbye', { code: 'my.error', exitCode: 2 }));125126// hook127expectType<commander.Command>(program.hook('preAction', () => {}));128expectType<commander.Command>(program.hook('postAction', () => {}));129expectType<commander.Command>(program.hook('preAction', async () => {}));130expectType<commander.Command>(131  program.hook('preAction', (thisCommand, actionCommand) => {132    // implicit parameter types133    expectType<commander.Command>(thisCommand);134    expectType<commander.Command>(actionCommand);135  }),136);137expectType<commander.Command>(program.hook('preSubcommand', () => {}));138expectType<commander.Command>(139  program.hook('preSubcommand', (thisCommand, subcommand) => {140    // implicit parameter types141    expectType<commander.Command>(thisCommand);142    expectType<commander.Command>(subcommand);143  }),144);145146// action147expectType<commander.Command>(program.action(() => {}));148expectType<commander.Command>(program.action(async () => {}));149program.action(function () {150  expectType<typeof program>(this);151});152153// option154expectType<commander.Command>(program.option('-a,--alpha'));155expectType<commander.Command>(program.option('-p, --peppers', 'Add peppers'));156expectType<commander.Command>(157  program.option('-s, --string [value]', 'default string', 'value'),158);159expectType<commander.Command>(160  program.option('-b, --boolean', 'default boolean', false),161);162expectType<commander.Command>(163  program.option('--drink <size', 'drink size', /small|medium|large/),164); // deprecated165166// example coercion functions from README167168function myParseInt(value: string): number {169  return parseInt(value);170}171172function increaseVerbosity(dummyValue: string, previous: number): number {173  return previous + 1;174}175176function collect(value: string, previous: string[]): string[] {177  return previous.concat([value]);178}179180function commaSeparatedList(value: string): string[] {181  return value.split(',');182}183184expectType<commander.Command>(185  program.option('-f, --float <number>', 'float argument', parseFloat),186);187expectType<commander.Command>(188  program.option('-f, --float <number>', 'float argument', parseFloat, 3.2),189);190expectType<commander.Command>(191  program.option('-i, --integer <number>', 'integer argument', myParseInt),192);193expectType<commander.Command>(194  program.option('-i, --integer <number>', 'integer argument', myParseInt, 5),195);196expectType<commander.Command>(197  program.option(198    '-v, --verbose',199    'verbosity that can be increased',200    increaseVerbosity,201    0,202  ),203);204expectType<commander.Command>(205  program.option('-c, --collect <value>', 'repeatable value', collect, []),206);207expectType<commander.Command>(208  program.option(209    '-l, --list <items>',210    'comma separated list',211    commaSeparatedList,212  ),213);214215// requiredOption, same tests as option216expectType<commander.Command>(program.requiredOption('-a,--alpha'));217expectType<commander.Command>(218  program.requiredOption('-p, --peppers', 'Add peppers'),219);220expectType<commander.Command>(221  program.requiredOption('-s, --string [value]', 'default string', 'value'),222);223expectType<commander.Command>(224  program.requiredOption('-b, --boolean', 'default boolean', false),225);226expectType<commander.Command>(227  program.requiredOption('--drink <size', 'drink size', /small|medium|large/),228); // deprecated229230expectType<commander.Command>(231  program.requiredOption('-f, --float <number>', 'float argument', parseFloat),232);233expectType<commander.Command>(234  program.requiredOption(235    '-f, --float <number>',236    'float argument',237    parseFloat,238    3.2,239  ),240);241expectType<commander.Command>(242  program.requiredOption(243    '-i, --integer <number>',244    'integer argument',245    myParseInt,246  ),247);248expectType<commander.Command>(249  program.requiredOption(250    '-i, --integer <number>',251    'integer argument',252    myParseInt,253    5,254  ),255);256expectType<commander.Command>(257  program.requiredOption(258    '-v, --verbose',259    'verbosity that can be increased',260    increaseVerbosity,261    0,262  ),263);264expectType<commander.Command>(265  program.requiredOption(266    '-c, --collect <value>',267    'repeatable value',268    collect,269    [],270  ),271);272expectType<commander.Command>(273  program.requiredOption(274    '-l, --list <items>',275    'comma separated list',276    commaSeparatedList,277  ),278);279280// createOption281expectType<commander.Option>(program.createOption('a, --alpha'));282expectType<commander.Option>(program.createOption('a, --alpha', 'description'));283284// addOption285expectType<commander.Command>(286  program.addOption(new commander.Option('-s,--simple')),287);288289// storeOptionsAsProperties290expectType<commander.Command & commander.OptionValues>(291  program.storeOptionsAsProperties(),292);293expectType<commander.Command & commander.OptionValues>(294  program.storeOptionsAsProperties(true),295);296expectType<commander.Command>(program.storeOptionsAsProperties(false));297298// getOptionValue299void program.getOptionValue('example');300301// setOptionValue302expectType<commander.Command>(program.setOptionValue('example', 'value'));303expectType<commander.Command>(program.setOptionValue('example', true));304305// setOptionValueWithSource306expectType<commander.Command>(307  program.setOptionValueWithSource('example', [], 'cli'),308);309310// getOptionValueSource311expectType<commander.OptionValueSource | undefined>(312  program.getOptionValueSource('example'),313);314315// getOptionValueSourceWithGlobals316expectType<commander.OptionValueSource | undefined>(317  program.getOptionValueSourceWithGlobals('example'),318);319320// combineFlagAndOptionalValue321expectType<commander.Command>(program.combineFlagAndOptionalValue());322expectType<commander.Command>(program.combineFlagAndOptionalValue(false));323324// allowUnknownOption325expectType<commander.Command>(program.allowUnknownOption());326expectType<commander.Command>(program.allowUnknownOption(false));327328// allowExcessArguments329expectType<commander.Command>(program.allowExcessArguments());330expectType<commander.Command>(program.allowExcessArguments(false));331332// enablePositionalOptions333expectType<commander.Command>(program.enablePositionalOptions());334expectType<commander.Command>(program.enablePositionalOptions(false));335336// passThroughOptions337expectType<commander.Command>(program.passThroughOptions());338expectType<commander.Command>(program.passThroughOptions(false));339340// parse341expectType<commander.Command>(program.parse());342expectType<commander.Command>(program.parse(process.argv));343expectType<commander.Command>(344  program.parse(['node', 'script.js'], { from: 'node' }),345);346expectType<commander.Command>(347  program.parse(['node', 'script.js'], { from: 'electron' }),348);349expectType<commander.Command>(program.parse(['--option'], { from: 'user' }));350expectType<commander.Command>(program.parse(['node', 'script.js'] as const));351352// parseAsync, same tests as parse353expectType<Promise<commander.Command>>(program.parseAsync());354expectType<Promise<commander.Command>>(program.parseAsync(process.argv));355expectType<Promise<commander.Command>>(356  program.parseAsync(['node', 'script.js'], { from: 'node' }),357);358expectType<Promise<commander.Command>>(359  program.parseAsync(['node', 'script.js'], { from: 'electron' }),360);361expectType<Promise<commander.Command>>(362  program.parseAsync(['--option'], { from: 'user' }),363);364expectType<Promise<commander.Command>>(365  program.parseAsync(['node', 'script.js'] as const),366);367368// parseOptions (and ParseOptionsResult)369expectType<{ operands: string[]; unknown: string[] }>(370  program.parseOptions(['node', 'script.js', 'hello']),371);372373// save/restore state374expectType<void>(program.saveStateBeforeParse());375expectType<void>(program.restoreStateBeforeParse());376377// opts378const opts = program.opts();379expectType<commander.OptionValues>(opts);380expectType(opts.foo);381expectType(opts.bar);382383// opts with generics384interface MyCheeseOption {385  cheese: string;386}387const myCheeseOption = program.opts<MyCheeseOption>();388expectType<string>(myCheeseOption.cheese);389// @ts-expect-error Check that options strongly typed and does not allow arbitrary properties390expectType(myCheeseOption.foo);391392// optsWithGlobals393const optsWithGlobals = program.optsWithGlobals();394expectType<commander.OptionValues>(optsWithGlobals);395expectType(optsWithGlobals.foo);396expectType(optsWithGlobals.bar);397398// optsWithGlobals with generics399const myCheeseOptionWithGlobals = program.optsWithGlobals<MyCheeseOption>();400expectType<string>(myCheeseOptionWithGlobals.cheese);401// @ts-expect-error Check that options strongly typed and does not allow arbitrary properties402expectType(myCheeseOptionWithGlobals.foo);403404// description405expectType<commander.Command>(program.description('my description'));406expectType<string>(program.description());407expectType<commander.Command>(408  program.description('my description of command with arg foo', {409    foo: 'foo description',410  }),411); // deprecated412413// summary414expectType<commander.Command>(program.summary('my summary'));415expectType<string>(program.summary());416417// alias418expectType<commander.Command>(program.alias('my alias'));419expectType<string>(program.alias());420421// aliases422expectType<commander.Command>(program.aliases(['first-alias', 'second-alias']));423expectType<commander.Command>(424  program.aliases(['first-alias', 'second-alias'] as const),425);426expectType<string[]>(program.aliases());427428// usage429expectType<commander.Command>(program.usage('my usage'));430expectType<string>(program.usage());431432// name433expectType<commander.Command>(program.name('my-name'));434expectType<string>(program.name());435436// helpGroup related437expectType<commander.Command>(program.helpGroup('My Group'));438expectType<string>(program.helpGroup());439440expectType<commander.Command>(program.commandsGroup('My Group'));441expectType<string>(program.commandsGroup());442443expectType<commander.Command>(program.optionsGroup('My Group'));444expectType<string>(program.optionsGroup());445446// nameFromFilename447expectType<commander.Command>(program.nameFromFilename(import.meta.filename));448449// executableDir450expectType<commander.Command>(program.executableDir(import.meta.dirname));451expectType<string | null>(program.executableDir());452453// outputHelp454expectType<void>(program.outputHelp());455expectType<void>(456  program.outputHelp((str: string) => {457    return str;458  }),459);460expectType<void>(program.outputHelp({ error: true }));461462// help463expectType<never>(program.help());464expectType<never>(465  program.help((str: string) => {466    return str;467  }),468);469expectType<never>(program.help({ error: true }));470471// helpInformation472expectType<string>(program.helpInformation());473expectType<string>(program.helpInformation({ error: true }));474475// helpOption476expectType<commander.Command>(program.helpOption('-h,--help'));477expectType<commander.Command>(478  program.helpOption('-h,--help', 'custom description'),479);480expectType<commander.Command>(481  program.helpOption(undefined, 'custom description'),482);483expectType<commander.Command>(program.helpOption(false));484485// addHelpOption486expectType<commander.Command>(487  program.addHelpOption(new commander.Option('-h,--help')),488);489490// addHelpText491expectType<commander.Command>(program.addHelpText('after', 'text'));492expectType<commander.Command>(program.addHelpText('afterAll', 'text'));493expectType<commander.Command>(program.addHelpText('before', () => 'before'));494expectType<commander.Command>(495  program.addHelpText('beforeAll', (context) => {496    expectType<boolean>(context.error);497    expectType<commander.Command>(context.command);498    return '';499  }),500);501502// on503expectType<commander.Command>(program.on('command:foo', () => {}));504505// createCommand506expectType<commander.Command>(program.createCommand());507expectType<commander.Command>(program.createCommand('name'));508509class MyCommand extends commander.Command {510  createCommand(name?: string): MyCommand {511    return new MyCommand(name);512  }513514  myFunction(): void {515    // do nothing.516  }517}518const myProgram = new MyCommand();519expectType<MyCommand>(myProgram.command('sub'));520521// configureHelp522expectType<commander.Help>(program.createHelp());523expectType<commander.Command>(524  program.configureHelp({525    sortSubcommands: true, // override property526    visibleCommands: () => [], // override method527  }),528);529expectType<commander.HelpConfiguration>(program.configureHelp());530531// copyInheritedSettings532expectType<commander.Command>(533  program.copyInheritedSettings(new commander.Command()),534);535536// showHelpAfterError537expectType<commander.Command>(program.showHelpAfterError());538expectType<commander.Command>(program.showHelpAfterError(true));539expectType<commander.Command>(program.showHelpAfterError('See --help'));540541// showSuggestionAfterError542expectType<commander.Command>(program.showSuggestionAfterError());543expectType<commander.Command>(program.showSuggestionAfterError(false));544545// configureOutput546expectType<commander.Command>(program.configureOutput({}));547expectType<commander.OutputConfiguration>(program.configureOutput());548549expectType<commander.Command>(550  program.configureOutput({551    writeOut: (str: string) => {552      console.log(str);553    },554    writeErr: (str: string) => {555      console.error(str);556    },557    outputError: (str: string, write: (str: string) => void) => {558      write(str);559    },560561    getOutHelpWidth: () => 80,562    getErrHelpWidth: () => 80,563564    getOutHasColors: () => true,565    getErrHasColors: () => true,566    stripColor: (str) => str,567  }),568);569570// Help571const helper = new commander.Help();572const helperCommand = new commander.Command();573const helperOption = new commander.Option('-a, --all');574const helperArgument = new commander.Argument('<file>');575576helper.prepareContext({});577helper.prepareContext({ helpWidth: 120, error: true, outputHasColors: false });578579expectType<number | undefined>(helper.helpWidth);580expectType<number>(helper.minWidthToWrap);581expectType<boolean>(helper.sortSubcommands);582expectType<boolean>(helper.sortOptions);583expectType<boolean>(helper.showGlobalOptions);584585expectType<string>(helper.subcommandTerm(helperCommand));586expectType<string>(helper.commandUsage(helperCommand));587expectType<string>(helper.commandDescription(helperCommand));588expectType<string>(helper.subcommandDescription(helperCommand));589expectType<string>(helper.optionTerm(helperOption));590expectType<string>(helper.optionDescription(helperOption));591expectType<string>(helper.argumentTerm(helperArgument));592expectType<string>(helper.argumentDescription(helperArgument));593594expectType<commander.Command[]>(helper.visibleCommands(helperCommand));595expectType<commander.Option[]>(helper.visibleOptions(helperCommand));596expectType<commander.Option[]>(helper.visibleGlobalOptions(helperCommand));597expectType<commander.Argument[]>(helper.visibleArguments(helperCommand));598599expectType<number>(helper.longestSubcommandTermLength(helperCommand, helper));600expectType<number>(helper.longestOptionTermLength(helperCommand, helper));601expectType<number>(helper.longestGlobalOptionTermLength(helperCommand, helper));602expectType<number>(helper.longestArgumentTermLength(helperCommand, helper));603expectType<number>(helper.padWidth(helperCommand, helper));604605expectType<number>(helper.displayWidth('some string'));606expectType<string>(helper.boxWrap('a b c', 50));607expectType<string>(608  helper.formatItem('--example', 12, 'example description', helper),609);610expectType<boolean>(helper.preformatted('a\nb c'));611612{613  const formattedItems = [614    '--example  example description',615    '--example2 example2 description',616  ];617  expectType<string[]>(618    helper.formatItemList('Options', formattedItems, helper),619  );620}621622{623  const unsortedOptions = [new commander.Option('-a, --all')];624  const sortedOptions = unsortedOptions;625  const groupsItemsOptionHeading = (option: commander.Option) =>626    option.helpGroupHeading ?? 'Options:';627  expectType<Map<string, commander.Option[]>>(628    helper.groupItems(unsortedOptions, sortedOptions, groupsItemsOptionHeading),629  );630}631632{633  const unsortedCommands = [new commander.Command('foo')];634  const sortedCommands = unsortedCommands;635  const groupsItemsCommandHeading = (cmd: commander.Command) =>636    cmd.helpGroup() ?? 'Commands:';637  expectType<Map<string, commander.Command[]>>(638    helper.groupItems(639      unsortedCommands,640      sortedCommands,641      groupsItemsCommandHeading,642    ),643  );644}645646expectType<string>(helper.styleTitle('Usage:'));647648expectType<string>(helper.styleUsage('foo [options] <file>'));649expectType<string>(helper.styleCommandText('foo'));650651expectType<string>(helper.styleCommandDescription('description'));652expectType<string>(helper.styleOptionDescription('description'));653expectType<string>(helper.styleSubcommandDescription('description'));654expectType<string>(helper.styleArgumentDescription('description'));655expectType<string>(helper.styleDescriptionText('description'));656657expectType<string>(helper.styleOptionTerm('-a, --all'));658expectType<string>(helper.styleSubcommandTerm('bar [options]'));659expectType<string>(helper.styleArgumentTerm('<file>'));660661expectType<string>(helper.styleOptionText('-a, --all'));662expectType<string>(helper.styleSubcommandText('bar'));663expectType<string>(helper.styleArgumentText('<file>'));664665expectType<string>(helper.formatHelp(helperCommand, helper));666667// Option properties668const baseOption = new commander.Option('-f,--foo', 'foo description');669expectType<string>(baseOption.flags);670expectType<string>(baseOption.description);671expectType<boolean>(baseOption.required);672expectType<boolean>(baseOption.optional);673expectType<boolean>(baseOption.variadic);674expectType<boolean>(baseOption.mandatory);675expectType<string | undefined>(baseOption.short);676expectType<string | undefined>(baseOption.long);677expectType<boolean>(baseOption.negate);678// eslint-disable-next-line @typescript-eslint/no-explicit-any679expectType<any>(baseOption.defaultValue);680expectType<string | undefined>(baseOption.defaultValueDescription);681expectType<unknown>(baseOption.presetArg);682expectType<string | undefined>(baseOption.envVar);683expectType<boolean>(baseOption.hidden);684expectType<string[] | undefined>(baseOption.argChoices);685expectType<string | undefined>(baseOption.helpGroupHeading);686687// Option methods688689// default690expectType<commander.Option>(baseOption.default(3));691expectType<commander.Option>(baseOption.default(60, 'one minute'));692693// preset694expectType<commander.Option>(baseOption.preset(123));695expectType<commander.Option>(baseOption.preset('abc'));696697// env698expectType<commander.Option>(baseOption.env('PORT'));699700// argParser701expectType<commander.Option>(702  baseOption.argParser((value: string) => parseInt(value)),703);704expectType<commander.Option>(705  baseOption.argParser((value: string, previous: string[]) => {706    return previous.concat(value);707  }),708);709710// makeOptionMandatory711expectType<commander.Option>(baseOption.makeOptionMandatory());712expectType<commander.Option>(baseOption.makeOptionMandatory(true));713714// hideHelp715expectType<commander.Option>(baseOption.hideHelp());716expectType<commander.Option>(baseOption.hideHelp(true));717expectType<commander.Option>(baseOption.hideHelp(false));718719// choices720expectType<commander.Option>(baseOption.choices(['a', 'b']));721expectType<commander.Option>(baseOption.choices(['a', 'b'] as const));722723// conflicts724expectType<commander.Option>(baseOption.conflicts('a'));725expectType<commander.Option>(baseOption.conflicts(['a', 'b']));726727// implies728expectType<commander.Option>(729  baseOption.implies({ option: 'VALUE', colour: false }),730);731732// name733expectType<string>(baseOption.name());734735// attributeName736expectType<string>(baseOption.attributeName());737738// helpGroup739expectType<commander.Option>(baseOption.helpGroup('My Group'));740// @ts-expect-error: Option helpGroup() can not be used as a getter.741baseOption.helpGroup();742743// isBoolean744expectType<boolean>(baseOption.isBoolean());745746// Argument properties747const baseArgument = new commander.Argument('<foo');748expectType<string>(baseArgument.description);749expectType<boolean>(baseArgument.required);750expectType<boolean>(baseArgument.variadic);751// eslint-disable-next-line @typescript-eslint/no-explicit-any752expectType<any>(baseArgument.defaultValue);753expectType<string | undefined>(baseArgument.defaultValueDescription);754expectType<string[] | undefined>(baseArgument.argChoices);755756// Argument methods757758// name759expectType<string>(baseArgument.name());760761// default762expectType<commander.Argument>(baseArgument.default(3));763expectType<commander.Argument>(baseArgument.default(60, 'one minute'));764765// argParser766expectType<commander.Argument>(767  baseArgument.argParser((value: string) => parseInt(value)),768);769expectType<commander.Argument>(770  baseArgument.argParser((value: string, previous: string[]) => {771    return previous.concat(value);772  }),773);774775// choices776expectType<commander.Argument>(baseArgument.choices(['a', 'b']));777expectType<commander.Argument>(baseArgument.choices(['a', 'b'] as const));778779// argRequired780expectType<commander.Argument>(baseArgument.argRequired());781782// argOptional783expectType<commander.Argument>(baseArgument.argOptional());784785// createArgument786expectType<commander.Argument>(program.createArgument('<name>'));787expectType<commander.Argument>(program.createArgument('<name>', 'description'));