Comments (5)
Yeah, we're probably just missing the prefix; can you paste ~5-10 lines of code that show the throw new Error
that's missing the globalThis
?
from ts-proto.
Sure thing! Here's a sample of what gets generated for google/protobuf/wrappers
:
export const Int64Value = {
encode(message: Int64Value, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.value !== BigInt("0")) {
if (BigInt.asIntN(64, message.value) !== message.value) {
throw new Error("value provided for field message.value of type int64 too large");
}
writer.uint32(8).int64(message.value.toString());
}
return writer;
},
And here is a sample of the Error
proto def:
syntax = "proto3";
package myapp.common.v1;
import "google/protobuf/struct.proto";
message Error {
string code = 1;
string message = 2;
google.protobuf.Struct extra = 3;
}
This simple diff:
if (BigInt.asUintN(64, message.positiveIntValue) !== message.positiveIntValue) {
- throw new Error("value provided for field message.positiveIntValue of type uint64 too large");
+ throw new globalThis.Error("value provided for field message.positiveIntValue of type uint64 too large");
}
Is enough to get rid of tsc
errors on these lines.
from ts-proto.
🎉 This issue has been resolved in version 1.166.4 🎉
The release is available on:
Your semantic-release bot 📦🚀
from ts-proto.
Thank you so much for the quick fix @stephenh! 🙏 I'll give this a try on Monday and report back if there are any issues.
from ts-proto.
Works great, thank you again @stephenh 🎉
from ts-proto.
Related Issues (20)
- I'm using the buf tool to generate a ts file and have set `-ts_proto_opt=esModuleInterop=true`, but the generated code still contains `import Long = require("long");` HOT 1
- Module has already exported a member named 'ServerStreamingMethodResult' HOT 7
- basic_string::_M_construct null not valid HOT 5
- removeEnumPrefix not working HOT 1
- fromJSON should accept both snake_case and camelCase keys HOT 1
- Provide Options type for execution in TS HOT 1
- Add common types to their own file/export w/outputIndex option HOT 2
- Questions about defaults, optionals, arrays, null/undefined HOT 2
- Mistake in nestjs doc: `HeroesService` should be `HeroServiceClient`? HOT 1
- Allow NestJS to leverage Generic definitions HOT 2
- Don't encode proto2 optional fields HOT 7
- `outputSchema=true` throwing when compiling `googleapis` protos HOT 1
- Why every message is genereated as optional HOT 2
- Value/ListValue do not include the required dependencies when using nestJs=true
- Optionally sort keys in output interface types? HOT 2
- Should deprecated fields be optional? HOT 3
- How to use with node js HOT 1
- Wrapper Types conversion does not work for repeated field
- Oneof objects do not follow generated interface. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ts-proto.