[slice-source] Add type definitions (#47690)

* [slice-source] Add type definitions

* Remove empty file

* Revert "Remove empty file"

This reverts commit 7365af4ede01c3bc51a27a20792a4ec3156c9d20.

* Fix lint
This commit is contained in:
Björn Harrtell 2020-09-17 18:19:20 +02:00 committed by GitHub
parent 4923c0dc8d
commit 0718ea0f9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 44 additions and 0 deletions

19
types/slice-source/index.d.ts vendored Normal file
View File

@ -0,0 +1,19 @@
// Type definitions for slice-source 0.4
// Project: https://github.com/mbostock/slice-source
// Definitions by: Björn Harrtell <https://github.com/bjornharrtell>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function slice(source: ReadableStream | ReadableStreamReader | SliceSource): SliceSource;
interface SliceChunk {
value: Uint8Array;
done: boolean;
}
interface SliceSource {
slice(length: number): Promise<Uint8Array>;
read(): Promise<SliceChunk>;
cancel(): Promise<void>;
}
export = slice;

View File

@ -0,0 +1 @@
import slice = require('slice-source');

View File

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

View File

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