Grpc-web: Typescript support

Created on 12 Jan 2017  路  10Comments  路  Source: grpc/grpc-web

Is there any plans to generate typescript definition files?

Most helpful comment

Right, so the ts-protoc-gen plugin is out: https://github.com/improbable-eng/ts-protoc-gen

It currently produces ts.d files for official protobuf/js (i.e. js_out) objects. We're currently in the process of open sourcing our TS interfaces for remote calls. Stay tuned :)

All 10 comments

Not yet. Are you aware of any typescript protobuf implementation?

This is needed for my team to adopt this. It has been on my long todo list. My plan was to see what it would take to wrap the NodeJS grpc support with TypeScript and then tackle grpc-web. I was assuming that .t.ds files could be generated for use on top of the existing JavaScript generated code.

It's not as nice as direct typescript but if you're looking for something that works today we're doing protobuf (grpc-gateway annotated) -> swagger -> typescript fetch client. You'll obviously have to run grpc-gateway and are can't use streaming but IMO still much better than writing boilerplate endpoint code.

Sorry for spelling etc on mobile

We are looking into this right now, with Michal etc from improbable.io. Will post our plan here soon.

Magnificent if this happens.
A while back I looked at the protoc javascript generator code to see how things are done but it got a bit lonely.
Would love to be in the loop if at all possible.

@quiasmo
The plan for the typescript support is:

  • for messages: build a protoc-gen-ts that will code-generate TS definitions for the protoc --js-out= compiled classes
  • for services: build the protoc-gen-ts which will build typed interfaces for remote calls. This unfortunately will differ from the nodejs APIs since typescript and EventEmitters don't gel well.

We currently are working on rewriting a prototype that we built internally (and is tied to our stack) and making it into proper stand-alone open source projects. Stay tuned.

Just gotta throw this in here:

the TS definitions will make dart much, much easier. And I'm a big fan of dart.

Right, so the ts-protoc-gen plugin is out: https://github.com/improbable-eng/ts-protoc-gen

It currently produces ts.d files for official protobuf/js (i.e. js_out) objects. We're currently in the process of open sourcing our TS interfaces for remote calls. Stay tuned :)

@mwitkow any updates on this so far?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rwlincoln picture rwlincoln  路  6Comments

dv29 picture dv29  路  6Comments

barrymichaeldoyle picture barrymichaeldoyle  路  4Comments

peteringram0 picture peteringram0  路  5Comments

smnbbrv picture smnbbrv  路  4Comments