GithubHelp home page GithubHelp logo

Comments (5)

stephenh avatar stephenh commented on June 15, 2024

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.

bgentry avatar bgentry commented on June 15, 2024

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.

stephenh avatar stephenh commented on June 15, 2024

🎉 This issue has been resolved in version 1.166.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

from ts-proto.

bgentry avatar bgentry commented on June 15, 2024

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.

bgentry avatar bgentry commented on June 15, 2024

Works great, thank you again @stephenh 🎉

from ts-proto.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.