-
-
Notifications
You must be signed in to change notification settings - Fork 76
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
Change from class methods to arrow functions #92
Conversation
Hey, there this looks promising. Have you seen the |
I have seen that, I realize that I didn't migrate that to arrow functions. Will update shortly. My second PR that I was going to send was moving the environment variable version of creating promises to proper protoc based flags. Though I could drop that in here as well. |
I'll update the PR later today with the Promise method migrated over as well. Also throwing in the ability to do:
So it doesn't feel experimental. |
I would prefer something that is less ambiguous perhaps |
Also, the reason why i inlined these types was that we were using methods. I believe that these types are already present in @grpc/grpc-js. hence we should use those instead of generating them from scratch |
Dug around in all of the @grpc/grpc-js import files and while they have some gernerics for the server side, they have not defined a generic for any of the calling patterns. Maybe I missed something, but noticed at a few places they just took everything and cast it to what they used rather than providing any interfaces to define against. Most of the generics were in the I've added support for two
|
This looks so sweet. 🥲 I love the fact that you have introduced prettier. I have always meant to do that. Seems like some of the tests are failing. probably a node version skew |
Ah yes. @grpc/grpc-js is poorly typed. It would make our lives a lot easier if you could send a PR to that repository introducing these types so we can rely on them instead of generating them. for short term, this is fine. |
Fixed the test failure. You're right node syntax issue... Curious, is there any reason this is in pure JavaScript rather than TypeScript, which would have smoothed out that issue? |
In the beginning, the project wasn’t big enough so started with javascript. also didn’t want to deal with typescript compilation. after it got big, I have added jsdoc types to provide intellisense. |
One option for making the calls into promises is to use
promisify
however, the current codebase generate class methods rather than arrow functions with means that you need to do a bind prior to calling promisify.From output of
test/rpcs.ts