58
shim.assert.strictEqual(typeof actual, 'string');
59
}
61
>
/**
62
>
* Typing wrapper around Object.keys()
63
>
*/
64
>
export function objectKeys<T extends {}>(object: T) {
65
return Object.keys(object) as (keyof T)[];
66
}
68
>
export interface RequireDirectoryOptions {
69
>
extensions?: ReadonlyArray<string>;
70
>
visit?: (commandObject: any, pathToFile: string, filename?: string) => any;
71
>
recurse?: boolean;
72
>
include?: RegExp | ((fileName: string) => boolean);
73
>
exclude?: RegExp | ((fileName: string) => boolean);
74
>
}
75
>
76
>
// Dependencies that might vary between CJS, ESM, and Deno are isolated:
77
>
export interface PlatformShim {
78
>
assert: {
79
>
notStrictEqual: (
80
>
expected: any,
81
>
observed: any,
82
>
message?: string | Error
83
>
) => void;
84
>
strictEqual: (
85
>
expected: any,
86
>
observed: any,
87
>
message?: string | Error
88
>
) => void;
89
>
};
90
>
findUp: (
91
>
startDir: string,
92
>
fn: (dir: string[], names: string[]) => string | undefined
93
>
) => string;
94
>
getCallerFile: () => string;
95
>
getEnv: (key: string) => string | undefined;
96
>
getProcessArgvBin: () => string;
97
>
inspect: (obj: object) => string;
98
>
mainFilename: string;
99
>
requireDirectory: Function;
100
>
stringWidth: (str: string) => number;
101
>
cliui: Function;
102
>
Parser: Parser;
103
>
path: {
104
>
basename: (p1: string, p2?: string) => string;
105
>
extname: (path: string) => string;
106
>
dirname: (path: string) => string;
107
>
relative: (p1: string, p2: string) => string;
108
>
resolve: (p1: string, p2: string) => string;
109
>
join: (p1: string, p2: string) => string;
110
>
};
111
>
process: {
112
>
argv: () => string[];
113
>
cwd: () => string;
114
>
emitWarning: (warning: string | Error, type?: string) => void;
115
>
execPath: () => string;
116
>
exit: (code: number) => void;
117
>
nextTick: (cb: Function) => void;
118
>
stdColumns: number | null;
119
>
};
120
>
readFileSync: (path: string, encoding: string) => string;
121
>
readdirSync: (
122
>
path: string,
123
>
opts: object
124
>
) => Array<string | Buffer<ArrayBufferLike>>[];
125
>
require: RequireType;
126
>
y18n: Y18N;
127
>
}
128
>
129
>
export interface RequireType {
130
>
(path: string): Function;
131
>
main: MainType;
132
>
}
133
>
134
>
export interface MainType {
135
>
filename: string;
136
>
children: MainType[];
137
>
}
138
>
139
>
export interface Y18N {
140
>
__(str: string, ...args: string[]): string;
141
>
__n(str: string, ...args: (string | number)[]): string;
142
>
getLocale(): string;
143
>
setLocale(locale: string): void;
144
>
updateLocale(obj: {[key: string]: string}): void;
145
>
}