Permalink
Browse files

Docs: Added information on how to use the stubs to README, see #718

  • Loading branch information...
dcodeIO committed Mar 23, 2017
1 parent 0bc4a14 commit 3ba3ad762f7486b4806ad1c45764e92a81ca24dd
Showing with 27 additions and 18 deletions.
  1. +7 −0 README.md
  2. +3 −2 stub-long.d.ts
  3. +2 −1 stub-node.d.ts
  4. +3 −3 tests/data/convert.js
  5. +4 −4 tests/data/mapbox/vector_tile.js
  6. +4 −4 tests/data/test.d.ts
  7. +4 −4 tests/data/test.js
@@ -452,6 +452,13 @@ var buffer = AwesomeMessage.encode(message).finish();
...
```
If you'd like to completely exclude long.js and/or node (Buffer) typings, there are two stubs available that can be referenced instead of the full type definitions:
```ts
/// <reference path="node_modules/protobufjs/stub-long.d.ts" />
/// <reference path="node_modules/protobufjs/stub-node.d.ts" />
```
Documentation
-------------
@@ -1,9 +1,10 @@
// minimal stub for Long instances for reference when not using long.js.
// minimal stub for Long instances for reference when not using long.js,
// i.e. <reference path="node_modules/protobufjs/stub-long.d.ts" />
type Long = LongStub;
interface LongStub {
lo: number,
hi: number,
unsigned: boolean
unsigned?: boolean
}
@@ -1,4 +1,5 @@
// minimal stub for node types for reference when not using node.
// minimal stub for node types for reference when not using node,
// i.e. <reference path="node_modules/protobufjs/stub-node.d.ts" />
type Buffer = BufferStub;
@@ -17,13 +17,13 @@ $root.Message = (function() {
* @type Object
* @property {string} [stringVal] Message stringVal.
* @property {Array.<string>} [stringRepeated] Message stringRepeated.
* @property {number|$protobuf.Long} [uint64Val] Message uint64Val.
* @property {Array.<number|$protobuf.Long>} [uint64Repeated] Message uint64Repeated.
* @property {number|Long} [uint64Val] Message uint64Val.
* @property {Array.<number|Long>} [uint64Repeated] Message uint64Repeated.
* @property {Uint8Array} [bytesVal] Message bytesVal.
* @property {Array.<Uint8Array>} [bytesRepeated] Message bytesRepeated.
* @property {number} [enumVal] Message enumVal.
* @property {Array.<number>} [enumRepeated] Message enumRepeated.
* @property {Object.<string,number|$protobuf.Long>} [int64Map] Message int64Map.
* @property {Object.<string,number|Long>} [int64Map] Message int64Map.
*/
/**
@@ -234,9 +234,9 @@ $root.vector_tile = (function() {
* @property {string} [stringValue] Value stringValue.
* @property {number} [floatValue] Value floatValue.
* @property {number} [doubleValue] Value doubleValue.
* @property {number|$protobuf.Long} [intValue] Value intValue.
* @property {number|$protobuf.Long} [uintValue] Value uintValue.
* @property {number|$protobuf.Long} [sintValue] Value sintValue.
* @property {number|Long} [intValue] Value intValue.
* @property {number|Long} [uintValue] Value uintValue.
* @property {number|Long} [sintValue] Value sintValue.
* @property {boolean} [boolValue] Value boolValue.
*/
@@ -534,7 +534,7 @@ $root.vector_tile = (function() {
* Properties of a Feature.
* @typedef vector_tile.Tile.Feature$Properties
* @type Object
* @property {number|$protobuf.Long} [id] Feature id.
* @property {number|Long} [id] Feature id.
* @property {Array.<number>} [tags] Feature tags.
* @property {*} [type] Feature type.
* @property {Array.<number>} [geometry] Feature geometry.
@@ -303,7 +303,7 @@ export namespace jspb {
type DefaultValues$Properties = {
stringField?: string;
boolField?: boolean;
intField?: (number|$protobuf.Long);
intField?: (number|Long);
enumField?: number;
emptyField?: string;
bytesField?: Uint8Array;
@@ -597,7 +597,7 @@ export namespace jspb {
type TestMapFieldsNoBinary$Properties = {
mapStringString?: { [k: string]: string };
mapStringInt32?: { [k: string]: number };
mapStringInt64?: { [k: string]: (number|$protobuf.Long) };
mapStringInt64?: { [k: string]: (number|Long) };
mapStringBool?: { [k: string]: boolean };
mapStringDouble?: { [k: string]: number };
mapStringEnum?: { [k: string]: number };
@@ -1218,8 +1218,8 @@ export namespace google {
type UninterpretedOption$Properties = {
name?: google.protobuf.UninterpretedOption.NamePart[];
identifierValue?: string;
positiveIntValue?: (number|$protobuf.Long);
negativeIntValue?: (number|$protobuf.Long);
positiveIntValue?: (number|Long);
negativeIntValue?: (number|Long);
doubleValue?: number;
stringValue?: Uint8Array;
aggregateValue?: string;
@@ -2891,7 +2891,7 @@ $root.jspb = (function() {
* @type Object
* @property {string} [stringField] DefaultValues stringField.
* @property {boolean} [boolField] DefaultValues boolField.
* @property {number|$protobuf.Long} [intField] DefaultValues intField.
* @property {number|Long} [intField] DefaultValues intField.
* @property {number} [enumField] DefaultValues enumField.
* @property {string} [emptyField] DefaultValues emptyField.
* @property {Uint8Array} [bytesField] DefaultValues bytesField.
@@ -5905,7 +5905,7 @@ $root.jspb = (function() {
* @type Object
* @property {Object.<string,string>} [mapStringString] TestMapFieldsNoBinary mapStringString.
* @property {Object.<string,number>} [mapStringInt32] TestMapFieldsNoBinary mapStringInt32.
* @property {Object.<string,number|$protobuf.Long>} [mapStringInt64] TestMapFieldsNoBinary mapStringInt64.
* @property {Object.<string,number|Long>} [mapStringInt64] TestMapFieldsNoBinary mapStringInt64.
* @property {Object.<string,boolean>} [mapStringBool] TestMapFieldsNoBinary mapStringBool.
* @property {Object.<string,number>} [mapStringDouble] TestMapFieldsNoBinary mapStringDouble.
* @property {Object.<string,number>} [mapStringEnum] TestMapFieldsNoBinary mapStringEnum.
@@ -12463,8 +12463,8 @@ $root.google = (function() {
* @type Object
* @property {Array.<google.protobuf.UninterpretedOption.NamePart>} [name] UninterpretedOption name.
* @property {string} [identifierValue] UninterpretedOption identifierValue.
* @property {number|$protobuf.Long} [positiveIntValue] UninterpretedOption positiveIntValue.
* @property {number|$protobuf.Long} [negativeIntValue] UninterpretedOption negativeIntValue.
* @property {number|Long} [positiveIntValue] UninterpretedOption positiveIntValue.
* @property {number|Long} [negativeIntValue] UninterpretedOption negativeIntValue.
* @property {number} [doubleValue] UninterpretedOption doubleValue.
* @property {Uint8Array} [stringValue] UninterpretedOption stringValue.
* @property {string} [aggregateValue] UninterpretedOption aggregateValue.

0 comments on commit 3ba3ad7

Please sign in to comment.