diff --git a/protobufjs/protobufjs-tests.ts b/protobufjs/protobufjs-tests.ts new file mode 100644 index 000000000..148eb05e3 --- /dev/null +++ b/protobufjs/protobufjs-tests.ts @@ -0,0 +1,11 @@ +/// + +import ProtoBuf = require("protobufjs"); + +ProtoBuf.loadProtoFile("test.proto", builder => { + builder.build(); + + var message: ProtoBuf.IProtoBufMessage; + message.toArrayBuffer(); + message.toBuffer(); +}); diff --git a/protobufjs/protobufjs.d.ts b/protobufjs/protobufjs.d.ts new file mode 100644 index 000000000..66a48dc78 --- /dev/null +++ b/protobufjs/protobufjs.d.ts @@ -0,0 +1,23 @@ +// Type definitions for ProtoBuf.js +// Project: https://github.com/dcodeIO/ProtoBuf.js +// Definitions by: Panu Horsmalahti +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module ProtoBuf { + export interface IBuilder { + build: () => T; + } + + export interface IProtoBufMessage { + toArrayBuffer(): ArrayBuffer; + toBuffer(): Buffer; + } + + export function loadProtoFile(filePath: string, callback: (builder: IBuilder) => void): any; +} + +declare module "protobufjs" { + export = ProtoBuf; +}