Proto2TypeScript icon indicating copy to clipboard operation
Proto2TypeScript copied to clipboard

Working example(s)?

Open btgoodwin opened this issue 7 years ago • 5 comments

I've searched for days for a working example of how someone has used this library to work with protocol buffers in TypeScript and have come up with nothing. The example provided in the README.md also indicates a method on ProtoBuf (protobufjs, I assume) that does not presently exist in that library (protoFromFile). I admit I'm still learning all the nuances of TypeScript and project configurations, however it would be great to see the source code of a working example for using this library and protobufs in general.

For my particular use case, I have a library that I'm porting from JS/Angular1 to TS/Angular2 as a ES2015 module, and it has some protocol buffers defined in it. I've tried going through the process of converting the proto files to JSON, and then from JSON to typings definitions as indicated in the README.md. I then installed those definitions (d.ts) into my global typings (typings install --global --save file:<path>/file.d.ts). When I then try to reference the default module name generated by this tool, Proto2TypeScript, in my TypeScript files, I get: Cannot find namespace 'Proto2TypeScript'. I also cannot import that module name, etc. which leaves me wondering what part of this process is actually broken since there is no end-to-end example that I can find.

btgoodwin avatar Nov 08 '16 14:11 btgoodwin