Skip to content

pbts 6.8.0 doesn't generate enum typings #836

@trxcllnt

Description

@trxcllnt

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions