Protocol Buffers in an Angular 2 Project

I am developing an Angular 2 application in which I want to use protocol buffers to send data to a golang server.

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

I also tried setting typing for protobufjs with typings install dt~protobufjs --global . When I import it, WebStorm says Cannot find module protobuf .

Any help! Appreciated!

+6
source share
1 answer

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

Then I just used it like this: import * as ProtoBuf from 'protobufjs';

Thanks!

+7
source

Source: https://habr.com/ru/post/1012259/


All Articles