Skip to content

fix: es6 export enum#1446

Merged
alexander-fenster merged 2 commits intoprotobufjs:masterfrom
sapphi-red:master
Jul 17, 2020
Merged

fix: es6 export enum#1446
alexander-fenster merged 2 commits intoprotobufjs:masterfrom
sapphi-red:master

Conversation

@sapphi-red
Copy link
Copy Markdown
Contributor

Added es6 export to enum when generating static code from .proto with es6 wrapper.

Example of generated static code

before

$root.Status = (function() {
    const valuesById = {}, values = Object.create(valuesById);
    values[valuesById[0] = "speaking"] = 0;
    values[valuesById[1] = "reviewing"] = 1;
    values[valuesById[2] = "pause"] = 2;
    return values;
})();

after

export const Status = $root.Status = (() => {
    const valuesById = {}, values = Object.create(valuesById);
    values[valuesById[0] = "speaking"] = 0;
    values[valuesById[1] = "reviewing"] = 1;
    values[valuesById[2] = "pause"] = 2;
    return values;
})();

@alexander-fenster alexander-fenster merged commit 9f33784 into protobufjs:master Jul 17, 2020
taylorcode pushed a commit to taylorcode/protobuf.js that referenced this pull request Oct 16, 2020
Co-authored-by: Alexander Fenster <fenster@google.com>
This was referenced May 20, 2022
@github-actions github-actions bot mentioned this pull request Jul 8, 2022
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

Successfully merging this pull request may close these issues.

2 participants