add type definitions for msgpack-lite package. (#11690)

This commit is contained in:
Endel Dreyer
2016-10-03 21:48:26 +02:00
committed by Mohamed Hegazy
parent e581a26a5f
commit 3ced2ed66c
2 changed files with 72 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
/// <reference path="msgpack-lite.d.ts" />
import * as msgpack from "msgpack-lite";
var encoded = msgpack.encode("");
msgpack.decode(encoded);

67
msgpack-lite/msgpack-lite.d.ts vendored Normal file
View File

@@ -0,0 +1,67 @@
// Type definitions for msgpack-lite 0.1.20
// Project: https://github.com/kawanet/msgpack-lite
// Definitions by: Endel Dreyer <https://github.com/endel/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module "msgpack-lite" {
import { Transform } from "stream";
namespace MsgpackLite {
interface BufferOptions { codec: any; }
interface Encoder {
bufferish: any;
maxBufferSize: number;
minBufferSize: number;
offset: number;
start: number;
write: (chunk: any) => void;
fetch: () => void;
flush: () => void;
push: (chunk: any) => void;
pull: () => number;
read: () => number;
reserve: (length: number) => number;
send: (buffer: Buffer) => void;
encode: (chunk: any) => void;
end: (chunk: any) => void;
}
interface Decoder {
bufferish: any;
offset: number;
fetch: () => void;
flush: () => void;
pull: () => number;
read: () => number;
write: (chunk: any) => void;
reserve: (length: number) => number;
decode: (chunk: any) => void;
push: (chunk: any) => void;
end: (chunk: any) => void;
}
interface EncodeStream extends Transform {
encoder: Encoder;
}
interface DecodeStream extends Transform {
decoder: Decoder;
}
interface Codec {
new (options?: any): Codec;
options: any;
init (): void;
}
export function encode(input: any, options?: BufferOptions): any;
export function decode(input: Buffer | Uint8Array | Array<number>, options?: BufferOptions): any;
export function createEncodeStream (): EncodeStream;
export function createDecodeStream (): DecodeStream;
export function createCodec (options?: any): Codec;
export function codec (): { preset: Codec };
}
export = MsgpackLite;
}