UNPKG

1.94 kBTypeScriptView Raw
1// Type definitions for debug 4.1
2// Project: https://github.com/visionmedia/debug
3// Definitions by: Seon-Wook Park <https://github.com/swook>
4// Gal Talmor <https://github.com/galtalmor>
5// John McLaughlin <https://github.com/zamb3zi>
6// Brasten Sager <https://github.com/brasten>
7// Nicolas Penin <https://github.com/npenin>
8// Kristian Brünn <https://github.com/kristianmitk>
9// Caleb Gregory <https://github.com/calebgregory>
10// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
11
12declare var debug: debug.Debug & { debug: debug.Debug; default: debug.Debug };
13
14export = debug;
15export as namespace debug;
16
17declare namespace debug {
18 interface Debug {
19 (namespace: string): Debugger;
20 coerce: (val: any) => any;
21 disable: () => string;
22 enable: (namespaces: string) => void;
23 enabled: (namespaces: string) => boolean;
24 formatArgs: (this: Debugger, args: any[]) => void;
25 log: (...args: any[]) => any;
26 selectColor: (namespace: string) => string | number;
27 humanize: typeof import('ms');
28
29 names: RegExp[];
30 skips: RegExp[];
31
32 formatters: Formatters;
33
34 inspectOpts?: {
35 hideDate?: boolean | number | null;
36 colors?: boolean | number | null;
37 depth?: boolean | number | null;
38 showHidden?: boolean | number | null;
39 };
40 }
41
42 type IDebug = Debug;
43
44 interface Formatters {
45 [formatter: string]: (v: any) => string;
46 }
47
48 type IDebugger = Debugger;
49
50 interface Debugger {
51 (formatter: any, ...args: any[]): void;
52
53 color: string;
54 diff: number;
55 enabled: boolean;
56 log: (...args: any[]) => any;
57 namespace: string;
58 destroy: () => boolean;
59 extend: (namespace: string, delimiter?: string) => Debugger;
60 }
61}