mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #3402 from panuhorsmalahti/protobuf
Add initial type definitions for ProtoBuf.js
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
/// <reference path="protobufjs.d.ts" />
|
||||
|
||||
import ProtoBuf = require("protobufjs");
|
||||
|
||||
ProtoBuf.loadProtoFile("test.proto", builder => {
|
||||
builder.build();
|
||||
|
||||
var message: ProtoBuf.IProtoBufMessage;
|
||||
message.toArrayBuffer();
|
||||
message.toBuffer();
|
||||
});
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
// Type definitions for ProtoBuf.js
|
||||
// Project: https://github.com/dcodeIO/ProtoBuf.js
|
||||
// Definitions by: Panu Horsmalahti <https://github.com/panuhorsmalahti>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module ProtoBuf {
|
||||
export interface IBuilder {
|
||||
build: <T>() => T;
|
||||
}
|
||||
|
||||
export 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