mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
Merge pull request #28472 from danwbyrne/stream-throttle
adds typings for the 'stream-throttle' package
This commit is contained in:
Vendored
+22
@@ -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});
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user