index.d.ts
2.4 KB
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
declare module 'pretty-error' {
namespace PrettyError {
function start(): any;
function stop(): any;
class ParsedError {
constructor(error: Error);
}
interface ConfigObject {
skipPackages?: boolean | string[];
skipPaths?: boolean | string[];
skip?: boolean | PrettyError.Callback | PrettyError.Callback[];
maxItems?: number;
skipNodeFiles?: boolean | any; // assuming this is optional
filters?: boolean | PrettyError.Callback | PrettyError.Callback[];
parsedErrorFilters?:
| boolean
| PrettyError.Callback
| PrettyError.Callback[];
aliases?: boolean | Object;
}
type Callback = (traceLine: Object | any, lineNumber: number) => boolean;
}
class PrettyError {
constructor();
start(): PrettyError;
stop(): any;
config(configObject: PrettyError.ConfigObject): PrettyError;
withoutColors(): PrettyError;
withColors(): PrettyError;
skipPackage(...packages: string[]): PrettyError;
unskipPackage(...packages: string[]): PrettyError;
unskipAllPackages(): PrettyError;
skipPath(...paths: string[]): PrettyError;
unskipPath(...paths: string[]): PrettyError;
unskipAllPaths(): PrettyError;
skip(callbacks: PrettyError.Callback): PrettyError;
unskip(callbacks: PrettyError.Callback): PrettyError;
unskipAll(): PrettyError;
skipNodeFiles(): any;
unskipNodeFiles(): any;
filter(callbacks: PrettyError.Callback): PrettyError;
removeFilter(callbacks: PrettyError.Callback): PrettyError;
removeAllFilters(): PrettyError;
filterParsedError(callbacks: PrettyError.Callback): PrettyError;
removeParsedErrorFilter(callbacks: PrettyError.Callback): PrettyError;
removeAllParsedErrorFilters(): PrettyError;
setMaxItems(maxItems: number): PrettyError;
alias(stringOrRx: string, alias: string): PrettyError;
removeAlias(stringOrRx: string): PrettyError;
removeAllAliases(): PrettyError;
appendStyle(toAppend: Object): PrettyError;
render(
e: PrettyError.ParsedError,
logIt?: boolean,
useColors?: boolean
): string;
getObject(e: Object): Object;
}
export = PrettyError;
}