I'm currently implementing some protocol buffers translation in my typescript project. I've gotten the proto files loaded into the ProtoBuilder (using the typescript definitions file from protobufjs.d.ts) and I've returned a ProtoBuf from the builder.
If I set a breakpoint after I have the ProtoBuf object in a variable named pb, I can call pb.decode(buffer) in the console and it works. TypeScript, however, doesn't like the syntax.
After much poking and prodding, including trying things like:
pb["decode"](buffer)
(This gives Error TS2349 Cannot invoke an expression whose type lacks a call signature.)
I still cannot get the TypeScript compiler like the code.
How do I get from a TypeScript ProtoBuf object to the decode function buried within the MetaMessage object?
If it matters, I'm in Visual Studio 2015 doing this.
edit: I can get around the problem using:
var decoder: any = pb["decode"];
decoder(buffer);
But I would prefer a more elegant solution if one exists.