-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Long not imported in generated TypeScript static code #940
Comments
I think that it will depend on the way you are building your application, and the way you are using In fact, by adding the type info to your I use The main thing to have in mind is that If you have a general proto management TS file maybe you could add these lines there. import * as protobuf from 'protobufjs/minimal';
import * as Long from 'long';
protobuf.util.Long = Long;
protobuf.configure(); Which would be the equivalent of doing something like this in a require environment: var $protobuf = require("protobufjs/minimal");
var Long = require("long");
$protobuf.util.Long = Long;
$protobuf.configure(); Just my two cents, I could have some misconception too though. |
Thank you! I'll be honest, I totally skipped over that part of the documentation since it's under the same heading as the stuff about building the library yourself. |
|
For those who run into this with Angular: I use a
I had to |
If you are using angular, you can insert these code to main.ts. import * as protobuf from 'protobufjs/minimal';
import * as Long from 'long';
if (environment.production) {
enableProdMode();
}
protobuf.util.Long = Long;
protobuf.configure(); It works fine for me. |
Greetings folks! I think we fixed this over in #1166 |
protobuf.js version: 6.8.0
After generating static code with pbjs and pbts:
I import from the generated typescript file:
Upon compilation of my TypeScript file, I get errors about not being able to find Long, e.g:
The errors go away if I modify types.d.ts to add an import near the top:
However, adding that line every time one of the proto files is modified won't be practical in the long term.
Sorry if this isn't a bug and I'm just misunderstanding something.
The text was updated successfully, but these errors were encountered: