From 57bfab5614e910391d3d62d3649386f4520da946 Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Sat, 15 Dec 2018 17:27:59 +0100 Subject: [PATCH] [get-port] Various fixes --- types/get-port/get-port-tests.ts | 21 ++++----- types/get-port/index.d.ts | 13 ++++-- types/get-port/tsconfig.json | 7 ++- types/get-port/tslint.json | 78 +------------------------------- 4 files changed, 21 insertions(+), 98 deletions(-) diff --git a/types/get-port/get-port-tests.ts b/types/get-port/get-port-tests.ts index 53a9e8e69b..5e47c33c1a 100644 --- a/types/get-port/get-port-tests.ts +++ b/types/get-port/get-port-tests.ts @@ -1,13 +1,10 @@ -import * as getPort from "get-port"; +import getPort = require('get-port'); -getPort().then(port => { - console.log(port); -}); - -getPort({ port: 3000 }).then(port => { - console.log(port); -}); - -getPort({ port: [3000, 3001] }).then(port => { - console.log(port); -}); +// $ExpectType Promise +getPort(); +// $ExpectType Promise +getPort({ port: 3000 }); +// $ExpectType Promise +getPort({ port: [3000, 3001] }); +// $ExpectType Promise +getPort({ host: 'foo.local' }); diff --git a/types/get-port/index.d.ts b/types/get-port/index.d.ts index f8adb4851e..9af3b311fc 100644 --- a/types/get-port/index.d.ts +++ b/types/get-port/index.d.ts @@ -1,9 +1,12 @@ // Type definitions for get-port 4.0 // Project: https://github.com/sindresorhus/get-port -// Definitions by: York Yao +// Definitions by: York Yao +// BendingBender // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare module "get-port" { - var getPort: (options?: { port?: number | ReadonlyArray, host?: string }) => PromiseLike - export = getPort; -} +declare function getPort(options?: { + port?: number | ReadonlyArray; + host?: string; +}): Promise; + +export = getPort; diff --git a/types/get-port/tsconfig.json b/types/get-port/tsconfig.json index c221d4e9fd..0d9f3a8975 100644 --- a/types/get-port/tsconfig.json +++ b/types/get-port/tsconfig.json @@ -2,12 +2,11 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6", - "dom" + "es6" ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -21,4 +20,4 @@ "index.d.ts", "get-port-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/get-port/tslint.json b/types/get-port/tslint.json index a41bf5d19a..f93cf8562a 100644 --- a/types/get-port/tslint.json +++ b/types/get-port/tslint.json @@ -1,79 +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, - "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" }