Add streamify-array typings (#45484)

This commit is contained in:
Joachim Van Herwegen 2020-06-16 11:17:03 +02:00 committed by GitHub
parent 1c238d7dd5
commit bc5b7623cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 50 additions and 0 deletions

16
types/streamify-array/index.d.ts vendored Normal file
View File

@ -0,0 +1,16 @@
// Type definitions for streamify-array 1.0
// Project: https://github.com/rubensworks/streamify-array.js#readme
// Definitions by: Joachim Van Herwegen <https://github.com/joachimvh>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import { Readable } from 'stream';
/**
* Converts an array into a Node readable stream.
* Elements get removed from the array when they are read from the stream.
*/
declare function streamifyArray(input: any[]): Readable;
export = streamifyArray;

View File

@ -0,0 +1,9 @@
import streamifyArray from 'streamify-array';
import { Readable } from 'stream';
const stream: Readable = streamifyArray([1, 2, 3]);
stream.on('data', (d) => console.log('Data: ' + d));
stream.on('end', () => console.log('Done!'));
// $ExpectError
streamifyArray();

View File

@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"esModuleInterop": true,
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"streamify-array-tests.ts"
]
}

View File

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