From b71e2304ffb6b13d80f4efb22ad51638f3531399 Mon Sep 17 00:00:00 2001 From: Eric Byers Date: Fri, 8 Sep 2017 16:14:07 -0500 Subject: [PATCH] Adding stoppable typings --- types/stoppable/index.d.ts | 7 +++++++ types/stoppable/stoppable-tests.ts | 8 ++++++++ types/stoppable/tsconfig.json | 22 ++++++++++++++++++++++ types/stoppable/tslint.json | 1 + 4 files changed, 38 insertions(+) create mode 100644 types/stoppable/index.d.ts create mode 100644 types/stoppable/stoppable-tests.ts create mode 100644 types/stoppable/tsconfig.json create mode 100644 types/stoppable/tslint.json diff --git a/types/stoppable/index.d.ts b/types/stoppable/index.d.ts new file mode 100644 index 0000000000..898d633555 --- /dev/null +++ b/types/stoppable/index.d.ts @@ -0,0 +1,7 @@ +// Type definitions for stoppable 1.0 +// Project: https://github.com/hunterloftis/stoppable +// Definitions by: Eric Byers +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + + +export const stoppable: (server:http.Server, grace?:number) => http.Server; diff --git a/types/stoppable/stoppable-tests.ts b/types/stoppable/stoppable-tests.ts new file mode 100644 index 0000000000..ec8c50d4c4 --- /dev/null +++ b/types/stoppable/stoppable-tests.ts @@ -0,0 +1,8 @@ +import http = require('http'); +import stoppable = require('stoppable'); + +const server:http.Server = stoppable(http.createServer()); +server.stop(); + +const server2:http.Server = stoppable(http.createServer(), 10000); +server2.stop(); diff --git a/types/stoppable/tsconfig.json b/types/stoppable/tsconfig.json new file mode 100644 index 0000000000..ae018fe536 --- /dev/null +++ b/types/stoppable/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "stoppable-tests.ts" + ] +} diff --git a/types/stoppable/tslint.json b/types/stoppable/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/stoppable/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }