From a96c7aabd4bf263aa3374ee0347d2f12db9d1a45 Mon Sep 17 00:00:00 2001 From: Mark Veronda Date: Tue, 2 Apr 2019 17:43:48 -0700 Subject: [PATCH 1/3] [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; From 6f51644af8b4975252fa563ae5be3682fd653659 Mon Sep 17 00:00:00 2001 From: Mark Veronda Date: Wed, 3 Apr 2019 09:33:37 -0700 Subject: [PATCH 2/3] [finalhandler] Set version to `v1.1.1` in header. --- types/finalhandler/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/finalhandler/index.d.ts b/types/finalhandler/index.d.ts index 79eaf0de13..0aa8545779 100644 --- a/types/finalhandler/index.d.ts +++ b/types/finalhandler/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for finalhandler +// Type definitions for finalhandler v1.1.1 // Project: https://github.com/pillarjs/finalhandler // Definitions by: Ilya Mochalov // Mark Veronda From 193a4d8287d74d254b1c517ae458bcee1572c588 Mon Sep 17 00:00:00 2001 From: Mark Veronda Date: Fri, 12 Apr 2019 10:22:12 -0700 Subject: [PATCH 3/3] [finalhandler] Turn off disabled rules and fix all lint errors. --- types/finalhandler/finalhandler-tests.ts | 10 +-- types/finalhandler/index.d.ts | 6 +- types/finalhandler/tslint.json | 79 +----------------------- 3 files changed, 9 insertions(+), 86 deletions(-) diff --git a/types/finalhandler/finalhandler-tests.ts b/types/finalhandler/finalhandler-tests.ts index 2667bfc5ac..f2705bd2fa 100644 --- a/types/finalhandler/finalhandler-tests.ts +++ b/types/finalhandler/finalhandler-tests.ts @@ -1,11 +1,11 @@ import { IncomingMessage, ServerResponse } from "http"; import finalhandler = require("finalhandler"); -let req: IncomingMessage; -let res: ServerResponse; -let options: { - env: string; - onerror: (err: any, req: IncomingMessage, res: ServerResponse) => void; +const req: IncomingMessage = null; +const res: ServerResponse = null; +const options = { + env: 'anEnv', + onerror: (err: any, req: IncomingMessage, res: ServerResponse): any => { return; } }; let result: (err: any) => void; diff --git a/types/finalhandler/index.d.ts b/types/finalhandler/index.d.ts index 0aa8545779..b143e92916 100644 --- a/types/finalhandler/index.d.ts +++ b/types/finalhandler/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for finalhandler v1.1.1 +// Type definitions for finalhandler 1.1 // Project: https://github.com/pillarjs/finalhandler // Definitions by: Ilya Mochalov // Mark Veronda @@ -12,8 +12,8 @@ declare function finalhandler(req: IncomingMessage, res: ServerResponse, options?: finalhandler.Options): (err: any) => void; declare namespace finalhandler { - export interface Options { - env?: string, + interface Options { + env?: string; onerror?: (err: any, req: IncomingMessage, res: ServerResponse) => void; } } diff --git a/types/finalhandler/tslint.json b/types/finalhandler/tslint.json index 3d59f55fda..f93cf8562a 100644 --- a/types/finalhandler/tslint.json +++ b/types/finalhandler/tslint.json @@ -1,80 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "npm-naming": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } + "extends": "dtslint/dt.json" }