From a96c7aabd4bf263aa3374ee0347d2f12db9d1a45 Mon Sep 17 00:00:00 2001 From: Mark Veronda Date: Tue, 2 Apr 2019 17:43:48 -0700 Subject: [PATCH] [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 --- types/finalhandler/finalhandler-tests.ts | 11 +++++------ types/finalhandler/index.d.ts | 19 ++++++++++--------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/types/finalhandler/finalhandler-tests.ts b/types/finalhandler/finalhandler-tests.ts index 772a788e30..2667bfc5ac 100644 --- a/types/finalhandler/finalhandler-tests.ts +++ b/types/finalhandler/finalhandler-tests.ts @@ -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); diff --git a/types/finalhandler/index.d.ts b/types/finalhandler/index.d.ts index d67b9e4a98..79eaf0de13 100644 --- a/types/finalhandler/index.d.ts +++ b/types/finalhandler/index.d.ts @@ -1,20 +1,21 @@ // Type definitions for finalhandler // Project: https://github.com/pillarjs/finalhandler // Definitions by: Ilya Mochalov +// Mark Veronda // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// -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;