Is there a protocol buffer compiler that outputs pure TypeScript files?

Viewed 934

https://github.com/improbable-eng/ts-protoc-gen seeems to output type definitions in d.ts files. Is it possible somehow to convert .proto files into .ts files (instead of separate .js and .d.ts)?

I have a fully TypeScript frontend, so no need for the .js + .d.ts duality.

1 Answers

I know that your question is old, but maybe this helps someone looking for answers today:

Yes, there are plugins for protoc that generate plain TypeScript.

  • The first one I learned about is ts-proto.

  • I needed support for for bigint and proto3 optionals, so I wrote another one: protobuf-ts
    It passes googles conformance tests (the official JS generator doesn't), comes with grpc-web and twirp support and has no external dependencies.

Related