Merge pull request #28472 from danwbyrne/stream-throttle

adds typings for the 'stream-throttle' package
This commit is contained in:
Armando Aguirre
2018-08-31 15:17:41 -07:00
committed by GitHub
4 changed files with 51 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
// Type definitions for stream-throttle 0.1
// Project: https://github.com/tjgq/node-stream-throttle
// Definitions by: Daniel Byrne <https://github.com/danwbyrne>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types = "node" />
import { Transform } from 'stream';
export interface ThrottleOptions {
readonly rate: number;
readonly chunksize?: number;
}
export class Throttle extends Transform {
constructor(options: ThrottleOptions);
}
export class ThrottleGroup {
constructor(options: ThrottleOptions);
throttle(options: ThrottleOptions): Throttle;
}
@@ -0,0 +1,7 @@
import { Throttle, ThrottleGroup } from 'stream-throttle';
const throttle = new Throttle({rate: 1});
const throttleGroup = new ThrottleGroup({rate: 1});
// $ExpectType Throttle
throttleGroup.throttle({rate: 1});
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"stream-throttle-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}