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

typescript definitions incorrect when using --es6 #822

Closed
Lopdo opened this issue Jun 5, 2017 · 1 comment
Closed

typescript definitions incorrect when using --es6 #822

Lopdo opened this issue Jun 5, 2017 · 1 comment

Comments

@Lopdo
Copy link

Lopdo commented Jun 5, 2017

protobuf.js version: 6.7.3

disclaimer: I am pretty new to typescript modules and using npm, so I might be missing something basic

I am trying to generate static module form my .proto file, but generated definitions file doesn't contain any properties or method on my messages

I have very simple proto file:

syntax = "proto3";

message TestMessage {
	int64 userId = 1;
	string userName = 2;
}

which I am trying to turn into static module using

pbjs -t static-module -w es6 -o pbmessages.js ./messages.proto
pbts -o pbmessages.d.ts pbmessages.js

This results in:

type TestMessage$Properties = {
    userId?: (number|Long);
    userName?: string;
};

export class TestMessage {
    constructor(properties?: TestMessage$Properties);
}

When I remove the --es6 param, I get results that looks correctly:

type TestMessage$Properties = {
    userId?: (number|Long);
    userName?: string;
};

export class TestMessage {

    constructor(properties?: TestMessage$Properties);

    public userId: (number|Long);

    public userName: string;

    public static create(properties?: TestMessage$Properties): TestMessage;
    public static encode(message: TestMessage$Properties, writer?: $protobuf.Writer): $protobuf.Writer;
    public static encodeDelimited(message: TestMessage$Properties, writer?: $protobuf.Writer): $protobuf.Writer;
    public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): TestMessage;
    public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): TestMessage;
    public static verify(message: { [k: string]: any }): string;
    public static fromObject(object: { [k: string]: any }): TestMessage;
    public static from(object: { [k: string]: any }): TestMessage;
    public static toObject(message: TestMessage, options?: $protobuf.ConversionOptions): { [k: string]: any };
    public toObject(options?: $protobuf.ConversionOptions): { [k: string]: any };
    public toJSON(): { [k: string]: any };
}
@Lopdo
Copy link
Author

Lopdo commented Jun 7, 2017

closed because it is duplicate of #820

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

1 participant