We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The docs say that enums are supported, but they're not being generated in my use. I've created a minimal example here.
package.json:
{ "dependencies": { "google-protobuf": "^3.14.0", "protoc-gen-ts": "^0.3.4", "typescript": "^3" }, "scripts": { "proto": "protoc --plugin=./node_modules/.bin/protoc-gen-ts.cmd --ts_out=. --proto_path=. sample.proto" } }
sample.proto:
syntax = "proto3"; message Example { Foo foo = 1; } enum Foo { UNKNOWN = 0; BAR = 1; BAZ = 2; }
Run:
npm install npm run proto
Resulting output (does not contain an enum Foo):
enum Foo
import * as pb_1 from "google-protobuf"; export class Example extends pb_1.Message { constructor(data?: any[] | { foo?: Foo; }) { super(); pb_1.Message.initialize(this, Array.isArray(data) && data, 0, -1, [], null); if (!Array.isArray(data) && typeof data == "object") { this.foo = data.foo; } } get foo(): Foo { return pb_1.Message.getFieldWithDefault(this, 1, undefined) as Foo; } set foo(value: Foo) { pb_1.Message.setField(this, 1, value); } toObject() { return { foo: this.foo }; } serialize(w?: pb_1.BinaryWriter): Uint8Array | undefined { const writer = w || new pb_1.BinaryWriter(); if (this.foo !== undefined) writer.writeEnum(1, this.foo); if (!w) return writer.getResultBuffer(); } serializeBinary(): Uint8Array { throw new Error("Method not implemented."); } static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Example { const reader = bytes instanceof Uint8Array ? new pb_1.BinaryReader(bytes) : bytes, message = new Example(); while (reader.nextField()) { if (reader.isEndGroup()) break; switch (reader.getFieldNumber()) { case 1: message.foo = reader.readEnum(); break; default: reader.skipField(); } } return message; } }
The text was updated successfully, but these errors were encountered:
i can reproduce this. Fixed by c765e3c
Sorry, something went wrong.
0.3.5 has landed and must have fixed this problem already.
Feel free to reopen it happens again.
No branches or pull requests
The docs say that enums are supported, but they're not being generated in my use. I've created a minimal example here.
Steps to reproduce
package.json:
sample.proto:
Run:
Resulting output (does not contain an
enum Foo
):The text was updated successfully, but these errors were encountered: