mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 15:27:05 +00:00
Move all packages to a types directory
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
|
||||
import * as express from 'express';
|
||||
import * as errorhandler from 'errorhandler';
|
||||
|
||||
var app = express();
|
||||
|
||||
app.use(errorhandler());
|
||||
|
||||
app.use(errorhandler({ log: true }));
|
||||
|
||||
app.use(errorhandler({ log: (err, str, req, res) => {
|
||||
const { message, name, stack } = err;
|
||||
const messageIsStr = message === str;
|
||||
|
||||
const requestWasFresh = req && req.fresh;
|
||||
const responseContentType = res && res.contentType
|
||||
}}))
|
||||
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
// Type definitions for errorhandler
|
||||
// Project: https://github.com/expressjs/errorhandler
|
||||
// Definitions by: Santi Albo <https://github.com/santialbo/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
|
||||
|
||||
import * as express from 'express';
|
||||
|
||||
declare function errorHandler(options?: errorHandler.Options): express.ErrorRequestHandler;
|
||||
|
||||
declare namespace errorHandler {
|
||||
interface LoggingCallback {
|
||||
(err: Error, str: string, req: express.Request, res: express.Response): void;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* Defaults to true.
|
||||
*
|
||||
* Possible values:
|
||||
* true : Log errors using console.error(str).
|
||||
* false : Only send the error back in the response.
|
||||
* A function : pass the error to a function for handling.
|
||||
*/
|
||||
log: boolean | LoggingCallback;
|
||||
}
|
||||
}
|
||||
|
||||
export = errorHandler;
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"errorhandler-tests.ts"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user