Use ReadonlyArray for choices.

This commit is contained in:
Steffen Viken Valvåg
2018-12-03 00:05:18 +01:00
parent 2854b92db0
commit eb769a40ab
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -370,7 +370,7 @@ declare namespace yargs {
O extends { number: true } ? number :
O extends { string: true } ? string :
O extends { normalize: true } ? string :
O extends { choices: Array<infer C> } ? C :
O extends { choices: ReadonlyArray<infer C> } ? C :
O extends { coerce: (arg: any) => infer T } ? T :
any;
@@ -389,7 +389,7 @@ declare namespace yargs {
type SyncCompletionFunction = (current: string, argv: any) => string[];
type AsyncCompletionFunction = (current: string, argv: any, done: (completion: ReadonlyArray<string>) => void) => void;
type MiddlewareFunction<T> = (args: Arguments<T>) => void;
type Choices = Array<string | true | undefined>;
type Choices = ReadonlyArray<string | true | undefined>;
type PositionalOptionsType = "boolean" | "number" | "string";
}
+1 -1
View File
@@ -668,7 +668,7 @@ function Argv$scriptName() {
}
type Color = "red" | "blue" | "green";
const colors: Color[] = ["red", "blue", "green"];
const colors: ReadonlyArray<Color> = ["red", "blue", "green"];
function Argv$inferOptionTypes() {
// $ExpectType { [x: string]: any; a: (string | number)[] | undefined; b: boolean | undefined; c: number; n: number | undefined; s: string | undefined; _: string[]; $0: string; }