mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
[finalhandler] Align types with usage as found in github repo.
The structure of `options` and the declaration as `finalhandler` and not `finalHandler` as found in the latest release: https://github.com/pillarjs/finalhandler/blob/v1.1.1/index.js#L84
This commit is contained in:
@@ -1,15 +1,14 @@
|
||||
import { IncomingMessage, ServerResponse } from "http";
|
||||
import finalHandler = require("finalhandler");
|
||||
import finalhandler = require("finalhandler");
|
||||
|
||||
let req: IncomingMessage;
|
||||
let res: ServerResponse;
|
||||
let options: {
|
||||
onerror: (err: any, req: IncomingMessage, res: ServerResponse) => void;
|
||||
message: boolean|((err: any, status: number) => string);
|
||||
stacktrace: boolean;
|
||||
env: string;
|
||||
onerror: (err: any, req: IncomingMessage, res: ServerResponse) => void;
|
||||
};
|
||||
|
||||
let result: (err: any) => void;
|
||||
|
||||
result = finalHandler(req, res);
|
||||
result = finalHandler(req, res, options);
|
||||
result = finalhandler(req, res);
|
||||
result = finalhandler(req, res, options);
|
||||
|
||||
19
types/finalhandler/index.d.ts
vendored
19
types/finalhandler/index.d.ts
vendored
@@ -1,20 +1,21 @@
|
||||
// Type definitions for finalhandler
|
||||
// Project: https://github.com/pillarjs/finalhandler
|
||||
// Definitions by: Ilya Mochalov <https://github.com/chrootsu>
|
||||
// Mark Veronda <https://github.com/hbomark>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { IncomingMessage, ServerResponse } from "http";
|
||||
import { IncomingMessage, ServerResponse } from 'http';
|
||||
|
||||
declare function finalHandler(req: IncomingMessage, res: ServerResponse, options?: finalHandler.Options): (err: any) => void;
|
||||
declare function finalhandler(req: IncomingMessage, res: ServerResponse,
|
||||
options?: finalhandler.Options): (err: any) => void;
|
||||
|
||||
declare namespace finalHandler {
|
||||
export interface Options {
|
||||
message?: boolean|((err: any, status: number) => string);
|
||||
onerror?: (err: any, req: IncomingMessage, res: ServerResponse) => void;
|
||||
stacktrace?: boolean;
|
||||
}
|
||||
declare namespace finalhandler {
|
||||
export interface Options {
|
||||
env?: string,
|
||||
onerror?: (err: any, req: IncomingMessage, res: ServerResponse) => void;
|
||||
}
|
||||
}
|
||||
|
||||
export = finalHandler;
|
||||
export = finalhandler;
|
||||
|
||||
Reference in New Issue
Block a user