Tim Hutt
Tim Hutt
There is a similar problem for `write` here: ``` write(obj: IDirectoryListing, pbf: Pbf): void { if (obj.entries) for (var i = 0; i < obj.entries.length; i++) pbf.writeMessage(1, DirectoryEntry.write, obj.entries[i]); }...
The problem is the `?`s - `_readField` needs to be able to handle the case where `obj` and `pbf` are `undefined` (for some reason). I think the error might actually...
Apart from that type issue (which I may resolve by just uninstalling `@types/pbf`), this works great for me! I have a 10 MB message that takes **10 seconds** to decode...
Unfortunately if I remove `@types/pbf` then the import statement does not work: import Pbf from 'pbf'; I tried creating `pbf.d.ts` containing `declare module 'pbf';` but then I get errors like...
Ah I found the magic "shut up typescript" incantation: ``` declare module 'pbf' { type Pbf = any; export = Pbf } ```
Ugh no that doesn't quite work because then you can't do `new Pbf`. :-(
Ok finally got it to work by copy/pasting the `@types/pbf' file into `pbf.d.ts` and fixing the `?`s: ``` declare module 'pbf' { class Pbf { static readonly Varint: 0; static...
Yep, though I'm not really sure about all the types. You might want to double check it yourself. E.g. are the `?`s here correct? ``` writeRawMessage(fn: (obj: T, pbf: Pbf)...
Ok I've been using this pull request for a little while and it seems to be working very well. My only suggestion is to add `/* tslint:disable */` at the...
Actually there is one other issue - sub-messages. Consider: ``` message Foo { Bar b = 1; } message Bar { uint32 a = 1; } ``` This will give...