[destroy-on-hwm] add typings

This commit is contained in:
Dimitri Benin 2017-08-18 11:09:17 +02:00
parent 7ad5650b35
commit 01725e3388
4 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,10 @@
import { PassThrough } from 'stream';
import destroyOnHWM = require('destroy-on-hwm');
const stream = new PassThrough();
destroyOnHWM(stream); // $ExpectType PassThrough
destroyOnHWM(stream, function(stream) {
this; // $ExpectType PassThrough
stream; // $ExpectType PassThrough
});

12
types/destroy-on-hwm/index.d.ts vendored Normal file
View File

@ -0,0 +1,12 @@
// Type definitions for destroy-on-hwm 1.0
// Project: https://github.com/stream-utils/destroy-on-hwm
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
/// <reference types="node" />
import { Writable } from 'stream';
export = destroyOnHwm;
declare function destroyOnHwm<T extends Writable>(stream: T, callback?: (this: T, stream: T) => void): T;

View File

@ -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-on-hwm-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }