-
Notifications
You must be signed in to change notification settings - Fork 760
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
TS declarations files are missing enums #403
Comments
Enum types are generated if they are nested (which was fixed in #385), but not at the top level. |
So after a bit more digging I see that TypeScript definitions are only generated for The main function in question is I can understand why it might not be required to generate A more complete example of the issue: syntax = "proto3";
// This enum will not be defined in TypeScript
enum Status {
UNKNOWN = 0;
HAPPY = 1;
SAD = 2;
}
service Greeter {
// Defined in TypeScript
rpc SayHello (HelloRequest) returns (HelloReply);
}
// Defined in TypeScript
message HelloRequest {
// Defined in TypeScript, even though it's not used, but still nested in a Message that is
enum NestedStatus {
UNKOWN = 0;
GOOD = 1;
BAD = 2;
}
string name = 1;
}
// Defined in TypeScript
message HelloReply {
string message = 1;
Status status = 2;
}
// NOT Defined in TypeScript
message AnotherMessage {
string msg = 1;
} What harm is there to define all messages and enums, even if they are not used in the service definition? |
Hello 馃憢!
I noticed that
Enum
types are missing in the generated.d.ts
files. This is an exampleThis file will generated the JS but not the declaration file
I made sure to run the command with the argument
--grpc-web_out=import_style=commonjs+dts
Thanks in advance
The text was updated successfully, but these errors were encountered: