Add pull-handshake

This commit is contained in:
Jaco Greeff 2018-09-14 14:01:24 +02:00
parent fa429746fd
commit bd937b9987
5 changed files with 43 additions and 1 deletions

25
types/pull-handshake/index.d.ts vendored Normal file
View File

@ -0,0 +1,25 @@
// Type definitions for pull-handshake 1.1.4
// Project: https://github.com/pull-stream/pull-handshake
// Definitions by: Jaco Greeff <https://github.com/jacogr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node"/>
declare module 'pull-handshake' {
type Options = {
timeout: number
};
export type Handshake = {
handshake: {
read: (length: number, cb: (error: Error, buffer: Buffer) => void) => void;
write: (buffer: Buffer) => void;
}
};
export type PullHandshake = (options?: Options, errorHandler?: (error?: Error) => void) => Handshake;
const handshake: PullHandshake;
export default handshake;
}

View File

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

View File

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

View File

@ -8,7 +8,7 @@
declare module 'pull-stream' {
export type PullStream = {
// FIXME this should be actual streams, not 'any'
(source: any, sink: any): void;
(...streams: Array<any>): void;
collect: (cb: (error: Error | null, values: Array<Buffer>) => any) => void,
drain: (handler: (message: Buffer) => void, errorHandler?: (error: Error) => boolean) => void;