Skip to content

Commit

Permalink
feat(types): update types
Browse files Browse the repository at this point in the history
  • Loading branch information
pooya parsa committed Feb 5, 2019
1 parent df73415 commit d0d7455
Showing 1 changed file with 40 additions and 13 deletions.
53 changes: 40 additions & 13 deletions types/consola.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
declare interface ConsolaReporter {
log: (logObj, { async, stdout, stderr }) => void
}

declare class Consola {
// Built-in log levels
static fatal (message: any): void;
static error (message: any): void;
static warn (message: any): void;
Expand All @@ -8,19 +13,41 @@ declare class Consola {
static success (message: any): void;
static ready (message: any): void;
static debug (message: any): void;
static trace (message: any): void;
static addReporter (reporter: (message: string) => void): (typeof Consola);
static removeReporter (): (typeof Consola);
static withTag (tag: string): (typeof Consola);
static withScope (tag: string): (typeof Consola);
static wrapAll (): void;
static restoreAll (): void;
static wrapConsole (): void;
static restoreConsole (): void;
static wrapStd (): void;
static restoreStd (): void;
static pauseLogs (): void;
static resumeLogs (): void;
static trace(message: any): void;

// Create
static create(options: any): (typeof Consola);
static withDefaults(defaults: any): (typeof Consola);

static withTag(tag: string): (typeof Consola);
static withScope(tag: string): (typeof Consola);

// Reporter
static addReporter(reporter: ConsolaReporter): (typeof Consola);
static setReporters(reporters: Array<ConsolaReporter>): (typeof Consola);

static removeReporter(reporter: any): (typeof Consola);
static remove(reporter: any): (typeof Consola);
static clear(reporter: any): (typeof Consola);

// Wrappers
static wrapAll(): void;
static restoreAll(): void;
static wrapConsole(): void;
static restoreConsole(): void;
static wrapStd(): void;
static restoreStd(): void;

// Pause/Resume
static pauseLogs(): void;
static pause(): void;

static resumeLogs(): void;
static resume(): void;

// Mock
static mockTypes(mockFn: any);
static mock(mockFn: any);
}

declare module "consola" {
Expand Down

0 comments on commit d0d7455

Please sign in to comment.