Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/yargs

Package Overview
Dependencies
Maintainers
1
Versions
150
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/yargs - npm Package Compare versions

Comparing version 15.0.15 to 15.0.16

204

yargs v15.0/index.d.ts

@@ -28,10 +28,13 @@ // Type definitions for yargs 15.0

import { DetailedArguments, Configuration } from 'yargs-parser';
import { Configuration, DetailedArguments } from "yargs-parser";
declare namespace yargs {
type BuilderCallback<T, R> = ((args: Argv<T>) => PromiseLike<Argv<R>>) | ((args: Argv<T>) => Argv<R>) | ((args: Argv<T>) => void);
type BuilderCallback<T, R> =
| ((args: Argv<T>) => PromiseLike<Argv<R>>)
| ((args: Argv<T>) => Argv<R>)
| ((args: Argv<T>) => void);
type ParserConfigurationOptions = Configuration & {
/** Sort commands alphabetically. Default is `false` */
'sort-commands': boolean;
"sort-commands": boolean;
};

@@ -58,4 +61,10 @@

// Aliases for previously declared options can inherit the types of those options.
alias<K1 extends keyof T, K2 extends string>(shortName: K1, longName: K2 | ReadonlyArray<K2>): Argv<T & { [key in K2]: T[K1] }>;
alias<K1 extends keyof T, K2 extends string>(shortName: K2, longName: K1 | ReadonlyArray<K1>): Argv<T & { [key in K2]: T[K1] }>;
alias<K1 extends keyof T, K2 extends string>(
shortName: K1,
longName: K2 | ReadonlyArray<K2>,
): Argv<T & { [key in K2]: T[K1] }>;
alias<K1 extends keyof T, K2 extends string>(
shortName: K2,
longName: K1 | ReadonlyArray<K1>,
): Argv<T & { [key in K2]: T[K1] }>;
alias(shortName: string | ReadonlyArray<string>, longName: string | ReadonlyArray<string>): Argv<T>;

@@ -85,3 +94,5 @@ alias(aliases: { [shortName: string]: string | ReadonlyArray<string> }): Argv<T>;

array<K extends keyof T>(key: K | ReadonlyArray<K>): Argv<Omit<T, K> & { [key in K]: ToArray<T[key]> }>;
array<K extends string>(key: K | ReadonlyArray<K>): Argv<T & { [key in K]: Array<string | number> | undefined }>;
array<K extends string>(
key: K | ReadonlyArray<K>,
): Argv<T & { [key in K]: Array<string | number> | undefined }>;

@@ -115,5 +126,13 @@ /**

*/
choices<K extends keyof T, C extends ReadonlyArray<any>>(key: K, values: C): Argv<Omit<T, K> & { [key in K]: C[number] | undefined }>;
choices<K extends string, C extends ReadonlyArray<any>>(key: K, values: C): Argv<T & { [key in K]: C[number] | undefined }>;
choices<C extends { [key: string]: ReadonlyArray<any> }>(choices: C): Argv<Omit<T, keyof C> & { [key in keyof C]: C[key][number] | undefined }>;
choices<K extends keyof T, C extends ReadonlyArray<any>>(
key: K,
values: C,
): Argv<Omit<T, K> & { [key in K]: C[number] | undefined }>;
choices<K extends string, C extends ReadonlyArray<any>>(
key: K,
values: C,
): Argv<T & { [key in K]: C[number] | undefined }>;
choices<C extends { [key: string]: ReadonlyArray<any> }>(
choices: C,
): Argv<Omit<T, keyof C> & { [key in keyof C]: C[key][number] | undefined }>;

@@ -136,5 +155,13 @@ /**

*/
coerce<K extends keyof T, V>(key: K | ReadonlyArray<K>, func: (arg: any) => V): Argv<Omit<T, K> & { [key in K]: V | undefined }>;
coerce<K extends string, V>(key: K | ReadonlyArray<K>, func: (arg: any) => V): Argv<T & { [key in K]: V | undefined }>;
coerce<O extends { [key: string]: (arg: any) => any }>(opts: O): Argv<Omit<T, keyof O> & { [key in keyof O]: ReturnType<O[key]> | undefined }>;
coerce<K extends keyof T, V>(
key: K | ReadonlyArray<K>,
func: (arg: any) => V,
): Argv<Omit<T, K> & { [key in K]: V | undefined }>;
coerce<K extends string, V>(
key: K | ReadonlyArray<K>,
func: (arg: any) => V,
): Argv<T & { [key in K]: V | undefined }>;
coerce<O extends { [key: string]: (arg: any) => any }>(
opts: O,
): Argv<Omit<T, keyof O> & { [key in keyof O]: ReturnType<O[key]> | undefined }>;

@@ -219,3 +246,7 @@ /**

config(): Argv<T>;
config(key: string | ReadonlyArray<string>, description?: string, parseFn?: (configPath: string) => object): Argv<T>;
config(
key: string | ReadonlyArray<string>,
description?: string,
parseFn?: (configPath: string) => object,
): Argv<T>;
config(key: string | ReadonlyArray<string>, parseFn: (configPath: string) => object): Argv<T>;

@@ -269,3 +300,6 @@ config(explicitConfigurationObject: object): Argv<T>;

demandOption<K extends keyof T>(key: K | ReadonlyArray<K>, msg?: string | true): Argv<Defined<T, K>>;
demandOption<K extends string>(key: K | ReadonlyArray<K>, msg?: string | true): Argv<T & { [key in K]: unknown }>;
demandOption<K extends string>(
key: K | ReadonlyArray<K>,
msg?: string | true,
): Argv<T & { [key in K]: unknown }>;
demandOption(key: string | ReadonlyArray<string>, demand?: boolean): Argv<T>;

@@ -407,3 +441,6 @@

*/
middleware(callbacks: MiddlewareFunction<T> | ReadonlyArray<MiddlewareFunction<T>>, applyBeforeValidation?: boolean): Argv<T>;
middleware(
callbacks: MiddlewareFunction<T> | ReadonlyArray<MiddlewareFunction<T>>,
applyBeforeValidation?: boolean,
): Argv<T>;

@@ -446,4 +483,10 @@ /**

*/
option<K extends keyof T, O extends Options>(key: K, options: O): Argv<Omit<T, K> & { [key in K]: InferredOptionType<O> }>;
option<K extends string, O extends Options>(key: K, options: O): Argv<T & { [key in K]: InferredOptionType<O> }>;
option<K extends keyof T, O extends Options>(
key: K,
options: O,
): Argv<Omit<T, K> & { [key in K]: InferredOptionType<O> }>;
option<K extends string, O extends Options>(
key: K,
options: O,
): Argv<T & { [key in K]: InferredOptionType<O> }>;
option<O extends { [key: string]: Options }>(options: O): Argv<Omit<T, keyof O> & InferredOptionTypes<O>>;

@@ -455,4 +498,10 @@

*/
options<K extends keyof T, O extends Options>(key: K, options: O): Argv<Omit<T, K> & { [key in K]: InferredOptionType<O> }>;
options<K extends string, O extends Options>(key: K, options: O): Argv<T & { [key in K]: InferredOptionType<O> }>;
options<K extends keyof T, O extends Options>(
key: K,
options: O,
): Argv<Omit<T, K> & { [key in K]: InferredOptionType<O> }>;
options<K extends string, O extends Options>(
key: K,
options: O,
): Argv<T & { [key in K]: InferredOptionType<O> }>;
options<O extends { [key: string]: Options }>(options: O): Argv<Omit<T, keyof O> & InferredOptionTypes<O>>;

@@ -467,3 +516,7 @@

parse(): { [key in keyof Arguments<T>]: Arguments<T>[key] };
parse(arg: string | ReadonlyArray<string>, context?: object, parseCallback?: ParseCallback<T>): { [key in keyof Arguments<T>]: Arguments<T>[key] };
parse(
arg: string | ReadonlyArray<string>,
context?: object,
parseCallback?: ParseCallback<T>,
): { [key in keyof Arguments<T>]: Arguments<T>[key] };

@@ -490,4 +543,10 @@ /**

*/
positional<K extends keyof T, O extends PositionalOptions>(key: K, opt: O): Argv<Omit<T, K> & { [key in K]: InferredOptionType<O> }>;
positional<K extends string, O extends PositionalOptions>(key: K, opt: O): Argv<T & { [key in K]: InferredOptionType<O> }>;
positional<K extends keyof T, O extends PositionalOptions>(
key: K,
opt: O,
): Argv<Omit<T, K> & { [key in K]: InferredOptionType<O> }>;
positional<K extends string, O extends PositionalOptions>(
key: K,
opt: O,
): Argv<T & { [key in K]: InferredOptionType<O> }>;

@@ -617,6 +676,26 @@ /** Should yargs provide suggestions regarding similar commands if no matching command is found? */

usage(message: string): Argv<T>;
usage<U>(command: string | ReadonlyArray<string>, description: string, builder?: (args: Argv<T>) => Argv<U>, handler?: (args: Arguments<U>) => void): Argv<T>;
usage<U>(command: string | ReadonlyArray<string>, showInHelp: boolean, builder?: (args: Argv<T>) => Argv<U>, handler?: (args: Arguments<U>) => void): Argv<T>;
usage<O extends { [key: string]: Options }>(command: string | ReadonlyArray<string>, description: string, builder?: O, handler?: (args: Arguments<InferredOptionTypes<O>>) => void): Argv<T>;
usage<O extends { [key: string]: Options }>(command: string | ReadonlyArray<string>, showInHelp: boolean, builder?: O, handler?: (args: Arguments<InferredOptionTypes<O>>) => void): Argv<T>;
usage<U>(
command: string | ReadonlyArray<string>,
description: string,
builder?: (args: Argv<T>) => Argv<U>,
handler?: (args: Arguments<U>) => void,
): Argv<T>;
usage<U>(
command: string | ReadonlyArray<string>,
showInHelp: boolean,
builder?: (args: Argv<T>) => Argv<U>,
handler?: (args: Arguments<U>) => void,
): Argv<T>;
usage<O extends { [key: string]: Options }>(
command: string | ReadonlyArray<string>,
description: string,
builder?: O,
handler?: (args: Arguments<InferredOptionTypes<O>>) => void,
): Argv<T>;
usage<O extends { [key: string]: Options }>(
command: string | ReadonlyArray<string>,
showInHelp: boolean,
builder?: O,
handler?: (args: Arguments<InferredOptionTypes<O>>) => void,
): Argv<T>;

@@ -788,34 +867,34 @@ /**

type InferredOptionType<O extends Options | PositionalOptions> =
O extends { default: any, coerce: (arg: any) => infer T } ? T :
O extends { default: infer D } ? D :
O extends { type: "count" } ? number :
O extends { count: true } ? number :
O extends { required: string | true } ? RequiredOptionType<O> :
O extends { require: string | true } ? RequiredOptionType<O> :
O extends { demand: string | true } ? RequiredOptionType<O> :
O extends { demandOption: string | true } ? RequiredOptionType<O> :
RequiredOptionType<O> | undefined;
type InferredOptionType<O extends Options | PositionalOptions> = O extends
{ default: any; coerce: (arg: any) => infer T } ? T
: O extends { default: infer D } ? D
: O extends { type: "count" } ? number
: O extends { count: true } ? number
: O extends { required: string | true } ? RequiredOptionType<O>
: O extends { require: string | true } ? RequiredOptionType<O>
: O extends { demand: string | true } ? RequiredOptionType<O>
: O extends { demandOption: string | true } ? RequiredOptionType<O>
: RequiredOptionType<O> | undefined;
type RequiredOptionType<O extends Options | PositionalOptions> =
O extends { type: "array", string: true } ? string[] :
O extends { type: "array", number: true } ? number[] :
O extends { type: "array", normalize: true } ? string[] :
O extends { type: "string", array: true } ? string[] :
O extends { type: "number", array: true } ? number[] :
O extends { string: true, array: true } ? string[] :
O extends { number: true, array: true } ? number[] :
O extends { normalize: true, array: true } ? string[] :
O extends { type: "array" } ? Array<string | number> :
O extends { type: "boolean" } ? boolean :
O extends { type: "number" } ? number :
O extends { type: "string" } ? string :
O extends { array: true } ? Array<string | number> :
O extends { boolean: true } ? boolean :
O extends { number: true } ? number :
O extends { string: true } ? string :
O extends { normalize: true } ? string :
O extends { choices: ReadonlyArray<infer C> } ? C :
O extends { coerce: (arg: any) => infer T } ? T :
unknown;
type RequiredOptionType<O extends Options | PositionalOptions> = O extends { type: "array"; string: true }
? string[]
: O extends { type: "array"; number: true } ? number[]
: O extends { type: "array"; normalize: true } ? string[]
: O extends { type: "string"; array: true } ? string[]
: O extends { type: "number"; array: true } ? number[]
: O extends { string: true; array: true } ? string[]
: O extends { number: true; array: true } ? number[]
: O extends { normalize: true; array: true } ? string[]
: O extends { type: "array" } ? Array<string | number>
: O extends { type: "boolean" } ? boolean
: O extends { type: "number" } ? number
: O extends { type: "string" } ? string
: O extends { array: true } ? Array<string | number>
: O extends { boolean: true } ? boolean
: O extends { number: true } ? number
: O extends { string: true } ? string
: O extends { normalize: true } ? string
: O extends { choices: ReadonlyArray<infer C> } ? C
: O extends { coerce: (arg: any) => infer T } ? T
: unknown;

@@ -840,5 +919,12 @@ type InferredOptionTypes<O extends { [key: string]: Options }> = { [key in keyof O]: InferredOptionType<O[key]> };

type ParseCallback<T = {}> = (err: Error | undefined, argv: Arguments<T>, output: string) => void;
type CommandBuilder<T = {}, U = {}> = { [key: string]: Options } | ((args: Argv<T>) => Argv<U>) | ((args: Argv<T>) => PromiseLike<Argv<U>>);
type CommandBuilder<T = {}, U = {}> =
| { [key: string]: Options }
| ((args: Argv<T>) => Argv<U>)
| ((args: Argv<T>) => PromiseLike<Argv<U>>);
type SyncCompletionFunction = (current: string, argv: any) => string[];
type AsyncCompletionFunction = (current: string, argv: any, done: (completion: ReadonlyArray<string>) => void) => void;
type AsyncCompletionFunction = (
current: string,
argv: any,
done: (completion: ReadonlyArray<string>) => void,
) => void;
type PromiseCompletionFunction = (current: string, argv: any) => Promise<string[]>;

@@ -845,0 +931,0 @@ type MiddlewareFunction<T = {}> = (args: Arguments<T>) => void;

{
"name": "@types/yargs",
"version": "15.0.15",
"version": "15.0.16",
"description": "TypeScript definitions for yargs",

@@ -60,4 +60,4 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs",

},
"typesPublisherContentHash": "7a706fdf1246d1f36538a21e0fbde4ae87cf370cac03b93854b1120dba730aed",
"typeScriptVersion": "4.2"
"typesPublisherContentHash": "62cc6c492efb0be6dc2b848f858fa1dc7ef407c175100fa8a184d92019f4245b",
"typeScriptVersion": "4.5"
}

@@ -11,3 +11,3 @@ # Installation

### Additional Details
* Last updated: Tue, 03 Jan 2023 23:02:56 GMT
* Last updated: Mon, 25 Sep 2023 05:35:36 GMT
* Dependencies: [@types/yargs-parser](https://npmjs.com/package/@types/yargs-parser)

@@ -14,0 +14,0 @@ * Global values: none

@@ -1,2 +0,2 @@

import { Argv } from '.';
import { Argv } from ".";

@@ -3,0 +3,0 @@ export = Yargs;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc