Options
All
  • Public
  • Public/Protected
  • All
Menu

Module yargs

Index

Type aliases

Arguments

Arguments<T>: T & { $0: string; _: string[] }

Type parameters

  • T

AsyncCompletionFunction

AsyncCompletionFunction: (current: string, argv: any, done: (completion: ReadonlyArray<string>) => void) => void

Type declaration

    • (current: string, argv: any, done: (completion: ReadonlyArray<string>) => void): void
    • Parameters

      Returns void

BuilderCallback

BuilderCallback<T, R>: ((args: Argv<T>) => Argv<R>) | ((args: Argv<T>) => void)

Type parameters

  • T

  • R

Choices

Choices: ReadonlyArray<string | number | true | undefined>

CommandBuilder

CommandBuilder<T, U>: {} | ((args: Argv<T>) => Argv<U>)

Type parameters

  • T

  • U

Defined

Defined<T, K>: Omit<T, K> & {}

Remove undefined as a possible value for keys K in T

Type parameters

  • T

  • K: keyof T

InferredOptionType

InferredOptionType<O>: 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 parameters

InferredOptionTypes

InferredOptionTypes<O>: {}

Type parameters

  • O: {}

Type declaration

MiddlewareFunction

MiddlewareFunction<T>: (args: Arguments<T>) => void

Type parameters

  • T

Type declaration

Omit

Omit<T, K>: {}

Remove keys K in T

Type parameters

  • T

  • K

Type declaration

ParseCallback

ParseCallback<T>: (err: Error | undefined, argv: Arguments<T>, output: string) => void

Type parameters

  • T

Type declaration

    • Parameters

      Returns void

ParserConfigurationOptions

ParserConfigurationOptions: Configuration & { sort-commands: boolean }

PositionalOptionsType

PositionalOptionsType: "boolean" | "number" | "string"

PromiseCompletionFunction

PromiseCompletionFunction: (current: string, argv: any) => Promise<string[]>

Type declaration

    • (current: string, argv: any): Promise<string[]>
    • Parameters

      • current: string
      • argv: any

      Returns Promise<string[]>

RequiredOptionType

RequiredOptionType<O>: O extends { string: true; type: "array" } ? string[] : O extends { number: true; type: "array" } ? number[] : O extends { normalize: true; type: "array" } ? string[] : O extends { array: true; type: "string" } ? string[] : O extends { array: true; type: "number" } ? number[] : O extends { array: true; string: true } ? string[] : O extends { array: true; number: true } ? number[] : O extends { array: true; normalize: 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 parameters

SyncCompletionFunction

SyncCompletionFunction: (current: string, argv: any) => string[]

Type declaration

    • (current: string, argv: any): string[]
    • Parameters

      • current: string
      • argv: any

      Returns string[]

ToArray

ToArray<T>: Array<Exclude<T, undefined>> | Extract<T, undefined>

Convert T to T[] and T | undefined to T[] | undefined

Type parameters

  • T

ToNumber

ToNumber<T>: Extract<T, undefined>

Gives number[] if T is an array type, otherwise number. Preserves | undefined.

Type parameters

  • T

ToString

ToString<T>: Extract<T, undefined>

Gives string[] if T is an array type, otherwise string. Preserves | undefined.

Type parameters

  • T