Add new typings for consola (#29923)

This commit is contained in:
Jungwoo An
2018-10-22 09:24:51 -07:00
committed by Sheetal Nandi
parent 47d137af32
commit daa2f21886
4 changed files with 73 additions and 0 deletions
+15
View File
@@ -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');
+39
View File
@@ -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;
+16
View File
@@ -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"]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}