mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-31 03:02:04 +08:00
Merge pull request #19862 from djcsdy/restify-lint
Fix restify declarations to comply with standard lint rules.
This commit is contained in:
4
types/restify/index.d.ts
vendored
4
types/restify/index.d.ts
vendored
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/restify/node-restify
|
||||
// Definitions by: Bret Little <https://github.com/blittle>, Steve Hipwell <https://github.com/stevehipwell>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
@@ -942,7 +942,7 @@ export interface Response extends http.ServerResponse {
|
||||
* @function redirect
|
||||
* @return {undefined}
|
||||
*/
|
||||
redirect(options: string | any, next: Next): void;
|
||||
redirect(options: object | string, next: Next): void;
|
||||
|
||||
/** HTTP status code. */
|
||||
code: number;
|
||||
|
||||
@@ -99,7 +99,7 @@ function send(req: restify.Request, res: restify.Response, next: restify.Next) {
|
||||
res.writeHead(200, {
|
||||
"Content-Type": "application/json"
|
||||
});
|
||||
return next();
|
||||
next();
|
||||
}
|
||||
|
||||
server.post('/hello', send);
|
||||
@@ -149,7 +149,9 @@ server.use(restify.plugins.throttle({
|
||||
}
|
||||
}));
|
||||
|
||||
server.on('after', restify.plugins.auditLogger({ event: 'after', log: {} as Logger }));
|
||||
const logger = Logger.createLogger({ name: "test" });
|
||||
|
||||
server.on('after', restify.plugins.auditLogger({ event: 'after', log: logger }));
|
||||
|
||||
server.on('after', (req: restify.Request, res: restify.Response, route: restify.Route, err: any) => {
|
||||
route.spec.method === 'GET';
|
||||
@@ -157,7 +159,7 @@ server.on('after', (req: restify.Request, res: restify.Response, route: restify.
|
||||
route.spec.path === '/some/path';
|
||||
route.spec.path === /\/some\/path\/.*/;
|
||||
route.spec.versions === ['v1'];
|
||||
restify.plugins.auditLogger({ event: 'after', log: {} as Logger })(req, res, route, err);
|
||||
restify.plugins.auditLogger({ event: 'after', log: logger })(req, res, route, err);
|
||||
});
|
||||
|
||||
(<any> restify).defaultResponseHeaders = function(this: restify.Request, data: any) {
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
// TODOs
|
||||
"no-any-union": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-void-expression": false
|
||||
}
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user