Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Protocol Buffers in Angular 2 project

I am developing an Angular 2 app in which I want to use Protocol Buffers to send data to a Go server.

I found this dcodeIO/protobufjs. But I don't understand how should I use this in my project?

I also tried installing the typings for protobufjs using typings install dt~protobufjs --global. When I import it, WebStorm says Cannot find module protobuf.

Any help is appreciated!

like image 455
cannot_mutably_borrow Avatar asked Nov 12 '16 09:11

cannot_mutably_borrow


1 Answers

I solved it! I did this npm install @types/protobufjs --save and I got the type definitions.

Then simply used it like this import * as ProtoBuf from 'protobufjs';

Thanks!

like image 141
cannot_mutably_borrow Avatar answered Oct 23 '22 10:10

cannot_mutably_borrow