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 definition file missing static "create", "encode" and "decode" methods #820

Closed
ben-x9 opened this issue Jun 2, 2017 · 5 comments

Comments

@ben-x9
Copy link

ben-x9 commented Jun 2, 2017

protobuf.js version: 6.7.3

I followed the README and ran this code to compile

$> pbjs -t static-module -w es6 -o compiled.js file1.proto file2.proto
$> pbts -o compiled.d.ts compiled.js

The generated compiled.js works fine but the compiled.d.ts file is missing static methods on all the classes:

type Success$Properties = {
    command?: CommandMsg$Properties;
};

/**
 * Constructs a new Success.
 * @exports Success
 * @constructor
 * @param {Success$Properties=} [properties] Properties to set
 */
export class Success {

    /**
     * Constructs a new Success.
     * @exports Success
     * @constructor
     * @param {Success$Properties=} [properties] Properties to set
     */
    constructor(properties?: Success$Properties);
}

type Failure$Properties = {
    type?: Failure.ErrorCode;
    details?: string;
};

/**
 * Constructs a new Failure.
 * @exports Failure
 * @constructor
 * @param {Failure$Properties=} [properties] Properties to set
 */
export class Failure {

    /**
     * Constructs a new Failure.
     * @exports Failure
     * @constructor
     * @param {Failure$Properties=} [properties] Properties to set
     */
    constructor(properties?: Failure$Properties);
}
@ben-x9 ben-x9 changed the title Message classes in TypeScript definition file missing static "create", "encode" and "decode" methods Classes in TypeScript definition file missing static "create", "encode" and "decode" methods Jun 2, 2017
@ben-x9 ben-x9 changed the title Classes in TypeScript definition file missing static "create", "encode" and "decode" methods TypeScript definition file missing static "create", "encode" and "decode" methods Jun 2, 2017
@Alexendoo
Copy link

This appears to happen whenever package is not specified in a .proto file

@Lopdo
Copy link

Lopdo commented Jun 7, 2017

Issue I reported (#822) seems to be duplicate of this. Is that intentional behaviour? Can it be fixed so that we don't need to specify package in our .proto file?

@dcodeIO
Copy link
Member

dcodeIO commented Jun 7, 2017

Do you know if this also affects master? (6.8.0)

@Alexendoo
Copy link

It does

@dcodeIO dcodeIO closed this as completed in cf36097 Jun 9, 2017
@dcodeIO
Copy link
Member

dcodeIO commented Jun 9, 2017

Can you confirm that this fixes this issue? Feel free to reopen if it does not (fully).

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