Git Product home page Git Product logo

Comments (8)

smnbbrv avatar smnbbrv commented on August 16, 2024

It looks like TestRequest is a message and you are creating a message by new TestRequest(). The constructor accepts another instance of TestRequest or an object that looks like TestRequest or no value. In case you pass one of them and it is a value, all the properties will be deeply cloned and assigned to corresponding properties in this message. So, IDE works quite fine here.

Here is an example of actually running the request with passing the parameters and IDE works as expected as well:

image

Properties are also normally well-documented with jsdoc comments. I don't have WebStorm (I use VSCode) so I can't validate it there, however there is nothing special in the generated code that normal IDE would not be able to support

from ngx-grpc.

bzvyagintsev avatar bzvyagintsev commented on August 16, 2024

How do you know what object you should pass in a message constructor? For example in EchoRequest (message, shouldThrow and timestamp)?

In our case I can see that it is RecursivePartial<GetMessagesByFolderRequest> but IDE suggest only methods:
image

So, I need to go to the constructor or to the documentation to know what params I should pass:
image

from ngx-grpc.

smnbbrv avatar smnbbrv commented on August 16, 2024

The first two, that are offered by IDE are in fact getters. Those technically are methods but not ordinary ones, they behave like normal properties on the object. What does IDE insert in case you hit enter on let's say mailbox getter?

Here is what is displayed in VSCode:

image

from ngx-grpc.

bzvyagintsev avatar bzvyagintsev commented on August 16, 2024

If I choose getter method, IDE inserts the following:
image

from ngx-grpc.

bzvyagintsev avatar bzvyagintsev commented on August 16, 2024

I have just tried to use suggestions in VS Code and they work:
image

Apparently, the question is in the WebStorm.

from ngx-grpc.

smnbbrv avatar smnbbrv commented on August 16, 2024

Yes, I think so too.

Probably try to raise the issue at JetBrains team. If you find a way to make it more WebStorm-friendly (maybe some special comment for each getter or similar) please let me know.

from ngx-grpc.

smnbbrv avatar smnbbrv commented on August 16, 2024

Hi @bzvyagintsev

I just had a random idea that might help here. Could you change in the generated code constructor TestRequest(_value?: RecursivePartial<TestRequest>) to constructor TestRequest(_value?: RecursivePartial<TestRequest.AsObject>) and say whether this resolves the issue? This structure of this object is actually the same as the message but with normally defined properties.

from ngx-grpc.

bzvyagintsev avatar bzvyagintsev commented on August 16, 2024

Hi

This way it works as expected:

image

from ngx-grpc.

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.