UNPKG

1.72 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
35 type IDebug = Debug;
36
37 interface Formatters {
38 [formatter: string]: (v: any) => string;
39 }
40
41 type IDebugger = Debugger;
42
43 interface Debugger {
44 (formatter: any, ...args: any[]): void;
45
46 color: string;
47 diff: number;
48 enabled: boolean;
49 log: (...args: any[]) => any;
50 namespace: string;
51 destroy: () => boolean;
52 extend: (namespace: string, delimiter?: string) => Debugger;
53 }
54}