Git Product home page Git Product logo

Comments (4)

melonmouse avatar melonmouse commented on May 24, 2024

P.S. if it is any help, if you'd write a "pseudo code" commit adding this functionality, I could complete that. Not sure if it would save you time, but wanted to offer :)

from protoc-gen-ts.

thesayyn avatar thesayyn commented on May 24, 2024

Hey, thank you for opening this. We had a brief conversation on another issue.

It makes more sense to continue the conversation here.

P.S. if it is any help, if you'd write a "pseudo code" commit adding this functionality, I could complete that. Not sure if it would save you time, but wanted to offer :)

I can assist you on the way if you could open up a draft pull request.

from protoc-gen-ts.

thesayyn avatar thesayyn commented on May 24, 2024

Hey @melonmouse

When you have some time, could you join the discussion at #39 about one-of-fields?

@melonmouse I have sent PR for this feature on #53

from protoc-gen-ts.

jackpunt avatar jackpunt commented on May 24, 2024

Sahin, sorry to be late getting to this, I've been off for the summer.
It seems that this needs a bit more work; consider:

message TypedMsg {
  oneof value {
    bool boolValue = 3;
    int32 intValue = 4;
    string strValue = 5;
  }
}

I believe it should be the case that:

let msgInt = new TypedMsg({intValue: 23})
let msgStr = new TypedMsg(strValue: "foo"})
assert( msgInt.intValue === 23)      // works
assert( msgStr.strValue === "foo")   // works
assert( msgInt.value === 23)         // fails: msgInt.value === "intValue"
assert( msgStr.value === "foo")      // fails: msgStr.value === "strValue"

The type of TypedValue.value should be: number | string | boolean | void [or | undefined? i'm not an expert on that ]
rather than: "intValue" | "strValue" | "boolValue" | "none"

from protoc-gen-ts.

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.