mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
[superagent-bunyan] Adding types for superagent-bunyan
This commit is contained in:
parent
7a15941349
commit
fe3c19d8bb
12
types/superagent-bunyan/index.d.ts
vendored
Normal file
12
types/superagent-bunyan/index.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
// Type definitions for superagent-bunyan 5.2
|
||||
// Project: https://github.com/joaquimserafim/superagent-bunyan#readme
|
||||
// Definitions by: Alex Brick <https://github.com/bricka>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import * as Logger from 'bunyan';
|
||||
import { Plugin } from 'superagent';
|
||||
|
||||
declare function superagentLogger(logger: Logger, requestId?: string, extra?: object): Plugin;
|
||||
|
||||
export = superagentLogger;
|
||||
16
types/superagent-bunyan/superagent-bunyan-tests.ts
Normal file
16
types/superagent-bunyan/superagent-bunyan-tests.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import * as request from 'superagent';
|
||||
import * as bunyan from 'bunyan';
|
||||
|
||||
import superagentLogger = require('superagent-bunyan');
|
||||
|
||||
const logger = bunyan.createLogger({name: 'my_log'});
|
||||
|
||||
logger.info('Hey!');
|
||||
|
||||
request
|
||||
.get('http://localhost:3000')
|
||||
.use(superagentLogger(logger))
|
||||
.use(superagentLogger(logger, 'requestId'))
|
||||
.use(superagentLogger(logger, 'requestId', { foo: 'bar' }))
|
||||
.use(superagentLogger(logger, undefined, { foo: 'bar' }))
|
||||
.end((err, res) => {});
|
||||
23
types/superagent-bunyan/tsconfig.json
Normal file
23
types/superagent-bunyan/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"superagent-bunyan-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/superagent-bunyan/tslint.json
Normal file
1
types/superagent-bunyan/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user