proto-loader + grpc-js + typescript without type casts
- Dominant language
- TypeScript
- Stars
- 4.8k
- Forks
- 716
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 10
Description
### Is your feature request related to a problem? Please describe.
I've been struggling to get my head around the exact interactions between proto-loader, grpc-js and typescript.
From what I can tell, the typescript types need to be static - so that the typescript compiler can see them.
Meanwhile, proto-loader only appears to have a dynamic mode where it reads from a `.proto` file.
This leads to a situation where the runtime code to load the `.proto` source requires explicit type casts to apply the correct typescript types.
### Describe the solution you'd like
It would be helpful if there was a way to generate the static equivalent of the proto-loader result in a way that matches the typescript definitions, so no typescript type casting is required, and the types and the loaded protobufs are kept in sync.
### Describe alternatives you've considered
From what I can tell, `grpc-tools` has a protobuf compilation option which can use `grpc-js`, but it's unclear to me if this produces code compatible with the types generated by `proto-loader`.
### Additional context
n/a
Contributor guide
Assessment
This issue has not been assessed yet.