deno.land / x / yargs@v17.6.0-deno / lib / typings / common-types.ts

common-types.ts
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
import {Parser} from './yargs-parser-types.js';
/** * A type that represents undefined or null */export type nil = undefined | null;
/** * An object whose all properties have the same type. */export type Dictionary<T = any> = {[key: string]: T};
/** * Returns the keys of T that match Dictionary<U> and are not arrays. */export type DictionaryKeyof<T, U = any> = Exclude< KeyOf<T, Dictionary<U>>, KeyOf<T, any[]>>;
/** * Returns the keys of T that match U. */export type KeyOf<T, U> = Exclude< {[K in keyof T]: T[K] extends U ? K : never}[keyof T], undefined>;
/** * An array whose first element is not undefined. */export type NotEmptyArray<T = any> = [T, ...T[]];
/** * Returns the type of a Dictionary or array values. */export type ValueOf<T> = T extends (infer U)[] ? U : T[keyof T];
/** * Typing wrapper around assert.notStrictEqual() */export function assertNotStrictEqual<N, T>( actual: T | N, expected: N, shim: PlatformShim, message?: string | Error): asserts actual is Exclude<T, N> { shim.assert.notStrictEqual(actual, expected, message);}
/** * Asserts actual is a single key, not a key array or a key map. */export function assertSingleKey( actual: string | string[] | Dictionary, shim: PlatformShim): asserts actual is string { shim.assert.strictEqual(typeof actual, 'string');}
/** * Typing wrapper around Object.keys() */export function objectKeys<T extends {}>(object: T) { return Object.keys(object) as (keyof T)[];}
export interface RequireDirectoryOptions { extensions?: ReadonlyArray<string>; visit?: (commandObject: any, pathToFile: string, filename?: string) => any; recurse?: boolean;}
// Dependencies that might vary between CJS, ESM, and Deno are isolated:export interface PlatformShim { assert: { notStrictEqual: ( expected: any, observed: any, message?: string | Error ) => void; strictEqual: ( expected: any, observed: any, message?: string | Error ) => void; }; findUp: ( startDir: string, fn: (dir: string[], names: string[]) => string | undefined ) => string; getCallerFile: () => string; getEnv: (key: string) => string | undefined; getProcessArgvBin: () => string; inspect: (obj: object) => string; mainFilename: string; requireDirectory: Function; stringWidth: (str: string) => number; cliui: Function; Parser: Parser; path: { basename: (p1: string, p2?: string) => string; extname: (path: string) => string; dirname: (path: string) => string; relative: (p1: string, p2: string) => string; resolve: (p1: string, p2: string) => string; }; process: { argv: () => string[]; cwd: () => string; emitWarning: (warning: string | Error, type?: string) => void; execPath: () => string; exit: (code: number) => void; nextTick: (cb: Function) => void; stdColumns: number | null; }; readFileSync: (path: string, encoding: string) => string; require: RequireType; y18n: Y18N;}
export interface RequireType { (path: string): Function; main: MainType;}
export interface MainType { filename: string; children: MainType[];}
export interface Y18N { __(str: string, ...args: string[]): string; __n(str: string, ...args: (string | number)[]): string; getLocale(): string; setLocale(locale: string): void; updateLocale(obj: {[key: string]: string}): void;}
yargs

Version Info

Tagged at
a year ago