mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Add initial type definitions for ProtoBuf.js
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
/// <reference path="protobuf.d.ts" />
|
||||
|
||||
import ProtoBuf = require("protobufjs");
|
||||
|
||||
ProtoBuf.loadProtoFile("test.proto", builder => {
|
||||
builder.build();
|
||||
|
||||
var message: ProtoBuf.IProtoBufMessage;
|
||||
message.toArrayBuffer();
|
||||
message.toBuffer();
|
||||
});
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
// 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 {
|
||||
interface IBuilder {
|
||||
build: <T>() => T;
|
||||
}
|
||||
|
||||
interface IProtoBufMessage {
|
||||
toArrayBuffer(): ArrayBuffer;
|
||||
toBuffer(): Buffer;
|
||||
}
|
||||
|
||||
export function loadProtoFile(filePath: string, callback: (builder: IBuilder) => void): any;
|
||||
}
|
||||
|
||||
declare module "protobufjs" {
|
||||
export = ProtoBuf;
|
||||
}
|
||||
Reference in New Issue
Block a user