Permalink
Browse files

Refactoring; Removed the need for triple-slash references in .d.ts by…

… providing a minimal Long interface, see #527, see #530
  • Loading branch information...
dcodeIO committed Dec 8, 2016
1 parent 228a202 commit 5606cb1bc41bc90cb069de676650729186b38640
@@ -17,7 +17,7 @@ browsers:
- name: iphone
version: [8.1, 9.0, latest]
scripts:
- scripts/polyfill.js
- lib/polyfill.js
- node_modules/long/dist/long.js
tunnel:
type: ngrok
@@ -185,7 +185,7 @@ message HelloReply {
```js
...
var Greeter = root.lookup("Greeter");
var greeter = Greeter.create(rpcImpl);
var greeter = Greeter.create(rpcImpl, false, false); // rpcImpl (see below), requestDelimited?, responseDelimited?
greeter.sayHello({ name: 'you' }, function(err, response) {
console.log('Greeting:', response.message);

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
BIN -1 Byte (100%) dist/protobuf.min.js.gz
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
File renamed without changes.
@@ -1,16 +1,6 @@
"use strict";
/**
* Minimal static codegen runtime.
* @namespace
*/
var runtime = exports;
/** @alias Reader */
runtime.Reader = require("./src/reader");
/** @alias Writer */
runtime.Writer = require("./src/writer");
/** @alias util */
runtime.util = require("./src/util/runtime");
// This file exports just the bare minimum required to work with statically generated code.
// Can be used as a drop-in replacement for the full library as it has the same general structure.
var protobuf_rt = exports;
protobuf_rt.Reader = require("./src/reader");
protobuf_rt.Writer = require("./src/writer");
protobuf_rt.util = require("./src/util/runtime");
@@ -4,9 +4,8 @@ var fs = require("fs"),
var dir = path.join(__dirname, "..", "types");
var header = [
'/// <reference types="node" />',
'/// <reference types="long" />',
"",
// '/// <reference types="long" />',
// "",
"/*",
" * protobuf.js v" + pkg.version + " TypeScript definitions",
" * Generated " + (new Date()).toUTCString().replace(/GMT/, "UTC"),
@@ -4,6 +4,15 @@ module.exports = LongBits;
var util = require("../util");
/**
* Any compatible Long instance.
* @typedef Long
* @type {Object}
* @property {number} low Low bits
* @property {number} high High bits
* @property {boolean} unsigned Whether unsigned or not
*/
/**
* Constructs new long bits.
* @classdesc Helper class for working with the low and high bits of a 64 bit value.
@@ -1,9 +1,6 @@
/// <reference types="node" />
/// <reference types="long" />
/*
* protobuf.js v6.1.0 TypeScript definitions
* Generated Wed, 07 Dec 2016 22:34:16 UTC
* Generated Thu, 08 Dec 2016 13:22:46 UTC
*/
declare module "protobufjs" {
@@ -826,7 +823,7 @@ declare module "protobufjs" {
/**
* Field names that belong to this oneof.
* @type {Array.<string>}
* @type {string[]}
*/
oneof: string[];
@@ -1497,6 +1494,21 @@ declare module "protobufjs" {
}
/**
* Any compatible Long instance.
* @typedef Long
* @type {Object}
* @property {number} low Low bits
* @property {number} high High bits
* @property {boolean} unsigned Whether unsigned or not
*/
interface Long {
low: number;
high: number;
unsigned: boolean;
}
/**
* Utility functions.
* @namespace

0 comments on commit 5606cb1

Please sign in to comment.