diff --git a/types/yargs/index.d.ts b/types/yargs/index.d.ts index 2bda1e9b6e..9adf019902 100644 --- a/types/yargs/index.d.ts +++ b/types/yargs/index.d.ts @@ -30,6 +30,11 @@ import { DetailedArguments, Configuration } from 'yargs-parser'; declare namespace yargs { type BuilderCallback = ((args: Argv) => Argv) | ((args: Argv) => void); + type ParserConfigurationOptions = Configuration & { + /** Sort commands alphabetically. Default is `false` */ + 'sort-commands': boolean; + }; + /** * The type parameter `T` is the expected shape of the parsed options. * `Arguments` is those options plus `_` and `$0`, and an indexer falling @@ -427,7 +432,7 @@ declare namespace yargs { parsed: DetailedArguments | false; /** Allows to configure advanced yargs features. */ - parserConfiguration(configuration: Partial): Argv; + parserConfiguration(configuration: Partial): Argv; /** * Similar to `config()`, indicates that yargs should interpret the object from the specified key in package.json as a configuration object. diff --git a/types/yargs/v13/index.d.ts b/types/yargs/v13/index.d.ts index a109053dff..ada306cb82 100644 --- a/types/yargs/v13/index.d.ts +++ b/types/yargs/v13/index.d.ts @@ -30,6 +30,11 @@ import { DetailedArguments, Configuration } from 'yargs-parser'; declare namespace yargs { type BuilderCallback = ((args: Argv) => Argv) | ((args: Argv) => void); + type ParserConfigurationOptions = Configuration & { + /** Sort commands alphabetically. Default is `false` */ + 'sort-commands': boolean; + }; + /** * The type parameter `T` is the expected shape of the parsed options. * `Arguments` is those options plus `_` and `$0`, and an indexer falling @@ -421,7 +426,7 @@ declare namespace yargs { parsed: DetailedArguments | false; /** Allows to configure advanced yargs features. */ - parserConfiguration(configuration: Partial): Argv; + parserConfiguration(configuration: Partial): Argv; /** * Similar to `config()`, indicates that yargs should interpret the object from the specified key in package.json as a configuration object. diff --git a/types/yargs/v13/yargs-tests.ts b/types/yargs/v13/yargs-tests.ts index 8ac6349c01..609a05be27 100644 --- a/types/yargs/v13/yargs-tests.ts +++ b/types/yargs/v13/yargs-tests.ts @@ -735,6 +735,7 @@ function Argv$parserConfiguration() { 'populate--': false, 'set-placeholder-key': false, 'short-option-groups': false, + 'sort-commands': true, }).parse(); const argv2 = yargs.parserConfiguration({ diff --git a/types/yargs/yargs-tests.ts b/types/yargs/yargs-tests.ts index 8ac6349c01..609a05be27 100644 --- a/types/yargs/yargs-tests.ts +++ b/types/yargs/yargs-tests.ts @@ -735,6 +735,7 @@ function Argv$parserConfiguration() { 'populate--': false, 'set-placeholder-key': false, 'short-option-groups': false, + 'sort-commands': true, }).parse(); const argv2 = yargs.parserConfiguration({