Protobuf.js: Typescript code generation

Created on 14 Feb 2016  路  7Comments  路  Source: protobufjs/protobuf.js

It would be really nice to have Typescript code generation out of the box with _pbjs_ tool.

There might be 2 different approaches:

  1. Generating TS classes

    • This is pretty much like official Protobufs client generating Java code

  2. Generating JS code and TS type definitions

    • _pbjs_ creates JS code (already there) and .d.ts files

Number#2 is currently achievable BTW, using multiple tools like this:

  • _pbjs_ creates JS code
  • _pbjs_ creates JSON definitions
  • _proto2typescript_ creates .d.ts files using those JSON definitions

I had to modify _proto2typescript_ to make it working BTW.

Related issues :

Most helpful comment

@dcodeIO is this something that you would consider? I think I might be able to contribute a PR as I need it myself as well.

All 7 comments

I would also find this useful. I鈥檓 currently down option number 2, and have had to spend time making proto2typescript work how I need it.

@dcodeIO is this something that you would consider? I think I might be able to contribute a PR as I need it myself as well.

I've written something like this already, could possibly wrap it up into the CLI and release it.

@dcodeIO any comments?

It would be great to have first-party support for this due to external tools always being slightly out of sync with development.

Closing this for now.

protobuf.js 6.0.0

Feel free to send a pull request if this is still a requirement.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

terranmoccasin picture terranmoccasin  路  5Comments

psaelango picture psaelango  路  4Comments

VitalyName picture VitalyName  路  3Comments

mj-mehdizadeh picture mj-mehdizadeh  路  5Comments

zD98 picture zD98  路  3Comments