mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 07:47:04 +00:00
Add new typings for consola (#29923)
This commit is contained in:
committed by
Sheetal Nandi
parent
47d137af32
commit
daa2f21886
@@ -0,0 +1,15 @@
|
||||
import * as consola from 'consola';
|
||||
|
||||
consola.start('TEST');
|
||||
consola.info('TEST');
|
||||
consola.success('TEST');
|
||||
consola.error('TEST');
|
||||
|
||||
const logger = new consola.Consola({
|
||||
level: 30,
|
||||
});
|
||||
|
||||
logger.start('TEST');
|
||||
logger.info('TEST');
|
||||
logger.success('TEST');
|
||||
logger.error('TEST');
|
||||
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
// Type definitions for consola 1.x
|
||||
// Project: https://github.com/nuxt/consola
|
||||
// Definitions by: Jungwoo An <https://github.com/Jungwoo-An>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
export interface LevelType {
|
||||
level: number;
|
||||
color: string;
|
||||
isError?: boolean;
|
||||
}
|
||||
|
||||
export interface Reporter {
|
||||
log(logObj: any): void;
|
||||
}
|
||||
|
||||
export interface Option {
|
||||
level?: number;
|
||||
types?: LevelType;
|
||||
reporters?: Reporter[];
|
||||
}
|
||||
|
||||
export class Consola {
|
||||
constructor(option?: Option);
|
||||
|
||||
add(reporter: Reporter): Consola;
|
||||
remove(reporter: Reporter): Consola;
|
||||
clear(): Consola;
|
||||
withScope(scope: string): void;
|
||||
start(...arguments: string[]): void;
|
||||
success(...arguments: string[]): void;
|
||||
info(...arguments: string[]): void;
|
||||
error(...arguments: Array<string | Error>): void;
|
||||
}
|
||||
|
||||
export function start(...arguments: string[]): void;
|
||||
export function success(...arguments: string[]): void;
|
||||
export function info(...arguments: string[]): void;
|
||||
export function error(...arguments: Array<string | Error>): void;
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noEmit": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "consola-tests.ts"]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user