From 125f33717d5a0551f020cd370031968483951fa1 Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Wed, 16 Aug 2017 09:24:20 +0200 Subject: [PATCH] [destroy] add typings --- types/destroy/destroy-tests.ts | 9 +++++++++ types/destroy/index.d.ts | 11 +++++++++++ types/destroy/tsconfig.json | 22 ++++++++++++++++++++++ types/destroy/tslint.json | 1 + 4 files changed, 43 insertions(+) create mode 100644 types/destroy/destroy-tests.ts create mode 100644 types/destroy/index.d.ts create mode 100644 types/destroy/tsconfig.json create mode 100644 types/destroy/tslint.json diff --git a/types/destroy/destroy-tests.ts b/types/destroy/destroy-tests.ts new file mode 100644 index 0000000000..15dbe62e32 --- /dev/null +++ b/types/destroy/destroy-tests.ts @@ -0,0 +1,9 @@ +import destroy = require('destroy'); +import * as fs from 'fs'; + +const stream = fs.createReadStream('package.json'); + +// $ExpectType ReadStream +destroy(stream); +// $ExpectType WriteStream +destroy(process.stderr); diff --git a/types/destroy/index.d.ts b/types/destroy/index.d.ts new file mode 100644 index 0000000000..7427655ace --- /dev/null +++ b/types/destroy/index.d.ts @@ -0,0 +1,11 @@ +// Type definitions for destroy 1.0 +// Project: https://github.com/stream-utils/destroy +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +import { Stream } from 'stream'; + +export = destroy; + +declare function destroy(stream: T): T; diff --git a/types/destroy/tsconfig.json b/types/destroy/tsconfig.json new file mode 100644 index 0000000000..197ac0c669 --- /dev/null +++ b/types/destroy/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", + "destroy-tests.ts" + ] +} diff --git a/types/destroy/tslint.json b/types/destroy/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/destroy/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }