Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pbts 6.8.0 doesn't generate enum typings #836

Closed
trxcllnt opened this issue Jun 17, 2017 · 4 comments
Closed

pbts 6.8.0 doesn't generate enum typings #836

trxcllnt opened this issue Jun 17, 2017 · 4 comments

Comments

@trxcllnt
Copy link

protobuf.js version: 6.8.0

First, let me say thanks for improving the generated typings between 6.7.3 and 6.8.0! The only issue I see now is the generated typings don't include enum definitions.

I'm generating static ES6 module from the proto file with pbjs, then generating typings with pbts this way:

$ pbjs -t static-module -w es6 -o ./vgraph.js ./vgraph.proto
$ pbts -o ./vgraph.d.ts ./vgraph.js

Here's a repro:

// vgraph.proto
message VectorGraph {
  enum GraphType {
    UNDIRECTED = 0;
    DIRECTED = 1;
  }
  enum AttributeTarget {
   VERTEX = 0;
   EDGE = 1;
  }
}

generated:

// vgraph.d.ts
import * as $protobuf from "protobufjs";
export interface IVectorGraph {}
export class VectorGraph {
    constructor(properties?: IVectorGraph);
    public static encode(message: IVectorGraph, writer?: $protobuf.Writer): $protobuf.Writer;
    public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): VectorGraph;
}

expected:

import * as $protobuf from "protobufjs";
export interface IVectorGraph {}
export class VectorGraph {
    constructor(properties?: IVectorGraph);
    public static encode(message: IVectorGraph, writer?: $protobuf.Writer): $protobuf.Writer;
    public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): VectorGraph;
}
export namespace VectorGraph {
    enum GraphType { UNDIRECTED, DIRECTED }
    enum AttributeTarget { VERTEX, EDGE }
}

Thanks!

@tamird
Copy link

tamird commented Jul 10, 2017

Also seeing this issue, which is blocking CockroachDB from using 6.8.0.

anoever added a commit to anoever/protobuf.js that referenced this issue Jul 30, 2017
@xealot
Copy link

xealot commented Sep 1, 2017

We just ran into this, any reason this PR isn't merged?

@xealot
Copy link

xealot commented Sep 21, 2017

Is this related to #780?

@flyskywhy
Copy link

jsdoc@3.6.x will cause the enum problem, so I solved it by:

cd node_modules/protobufjs
sed -i "s/\"jsdoc\": \".*\"/\"jsdoc\": \"3.5.5\"/" package.json
cd cli
npm install jsdoc@3.5.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants