grpc_tools_node_protoc_ts
grpc_tools_node_protoc_ts copied to clipboard
Add `export {}` to empty files
When creating empty files (like when there is no service), the typescript files should still have an export {} so that the files are recognized as modules.
Otherwise export * from './empty won't work.
See https://github.com/microsoft/TypeScript/issues/46343
I made some tests, if the proto file contains no services:
- empty proto file
- only with some
message
Generated *_grpc_pb.js contains only one line:
// GENERATED CODE -- NO SERVICES IN PROTO
So I think your requirement requires https://github.com/grpc/grpc-node to make the change first. I mean they need to patch the command line tool to output sth like:
// *_grpc_pb.js
// GENERATED CODE -- NO SERVICES IN PROTO
exports = {};
Changes on this d.ts tools can't change the js source code.
BTW the version of command line tool of mine in using is: [email protected].