[logstub] Add types (#45642)

This commit is contained in:
Emily Marigold Klassen 2020-06-22 11:34:40 -07:00 committed by GitHub
parent 46bfa5ff65
commit 85f74adbae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 76 additions and 0 deletions

44
types/logstub/index.d.ts vendored Normal file
View File

@ -0,0 +1,44 @@
// Type definitions for logstub 1.3
// Project: https://github.com/OutOfSyncStudios/logstub#readme
// Definitions by: Emily M Klassen <https://github.com/forivall>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = LogStub;
declare class LogStub {
constructor(...args: any[]);
log(...args: any[]): void;
silly(...args: any[]): void;
debug(...args: any[]): void;
verbose(...args: any[]): void;
info(...args: any[]): void;
warn(...args: any[]): void;
error(...args: any[]): void;
assert(...args: any[]): void;
clear(...args: any[]): void;
count(...args: any[]): void;
countReset(...args: any[]): void;
dir(...args: any[]): void;
dirxml(...args: any[]): void;
group(...args: any[]): void;
groupCollapsed(...args: any[]): void;
groupEnd(...args: any[]): void;
table(...args: any[]): void;
time(...args: any[]): void;
timeEnd(...args: any[]): void;
timeLog(...args: any[]): void;
fatal(...args: any[]): void;
trace(...args: any[]): void;
all(...args: any[]): void;
critical(...args: any[]): void;
child(
...args: any[]
): Pick<this, 'debug'| 'info' | 'warn' | 'error' | 'child' | 'level'>;
level(...args: any[]): number;
}

View File

@ -0,0 +1,8 @@
import LogStub = require('logstub');
// Ensure type compatability with bunyan
// tslint:disable-next-line: no-object-literal-type-assertion
const bunyanStub: Pick<LogStub, Extract<keyof import('bunyan'), keyof LogStub>> = {} as import('bunyan');
// Ensure type compatability with console
const consoleStub: Pick<Console, Extract<keyof Console, keyof LogStub>> = console;

View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"logstub-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }