-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.ts
34 lines (28 loc) · 1.05 KB
/
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
type Names = (string | Names)[];
interface Data {}
/**
* @typedef {Error} CustomError
* @property {string} name - error name
* @property {string} message - error message
* @property {string} stack - error stack trace
* @property {Object} details - error details
* @property {Array.<Array|string>} names - hierarchy of extended/parent error names
*/
interface CustomError<D = { [key: string]: unknown }> extends Error {
names: Names;
details?: D;
}
type Arg<D> = Error | CustomError | string | D | undefined | null;
interface CustomErrorConstructor<D> extends CustomError {
new(arg1?: Arg<D>, arg2?: Arg<D>, arg3?: Arg<D>): CustomError<D>;
(arg1?: Arg<D>, arg2?: Arg<D>, arg3?: Arg<D>): CustomError<D>;
stackTraceLimit: ErrorConstructor["stackTraceLimit"];
captureStackTrace: ErrorConstructor["captureStackTrace"];
}
/**
* @property cleanStackTraces - should stack trace be cleaned up from node internals
*/
interface Options {
cleanStackTraces?: boolean;
}
export type { Options, Names, Data, Arg, CustomError, CustomErrorConstructor };