protobuf.js version: 6.8.8
Take the following .proto file:
syntax = "proto3";
message Test {
Status status = 0;
}
enum Status {
STATUS_ERROR = 0;
STATUS_OK = 1;
}
With the following commands:
pbjs -t static-module -w es6 -o ./test.js ./test.proto
pbts -o ./test.d.ts ./test.js
The generated .d.ts file will be unusable, as it references the type Status, buts its definition is missing. Using commonjs instead of es6 yields the same results.
Reversing the order of the definitions leads to a different result: while a Status definition is emitted, now ITest is missing instead.
~The issue seems to be fixed in the protobuf.js master, when can we expect a new release?~
It seems the issue occurs depending on the versions of installed dependencies of the CLI:
npm install in both the repository root and the cli subdir, correct definitions are emittednpm install runs or use npm or yarn to install protobuf.js from the NPM registry or directly from the Git repo, pbjs/pbts will install additional dependencies on first run. Whenever this happens, the installation emits broken Typescript declarations.Running into same issues
Moreover, it seems that messages defined after an enum declaration do not have appropriate interfaces. It's utterly broken and is preventing successful builds
@dcodeIO did https://github.com/protobufjs/protobuf.js/pull/1356 resolve this issue?
Most helpful comment
Moreover, it seems that messages defined after an enum declaration do not have appropriate interfaces. It's utterly broken and is preventing successful builds