Skip to content
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

Added ability to generate typings for grpc-node service files #42

Closed
wants to merge 3 commits into from

Conversation

foxdavidj
Copy link

This PR adds the ability for users to output typings for the service files generated by protoc for node. Let me know if you have any questions or concerns about adding this to the library :)

Note: The addition of the two deps is strictly for the types they provide.

@anisimovsergey
Copy link

Exactly what I need!

@jonny-improbable
Copy link
Contributor

Thanks for contributing @OBTo; this looks great! Before I can merge this please could you follow up with the following changes:

  1. Pull your new code out into a separate file, let's keep service generation separate
  2. Add test coverage to ensure that the generated .d.ts are valid and don't regress with future changes (we have examples of this already for the grpc-web service definitions).

@MOZGIII
Copy link

MOZGIII commented Mar 29, 2018

Just FYI, this seem to require the js files to be generated separately by the grpc-tools package.
I'm using @OBTo's fork for now, looking forward to the merge.

@jonahbron
Copy link
Contributor

Not totally sure, but this might be rendered moot by #40

@Junkern
Copy link
Contributor

Junkern commented May 22, 2018

What is the status of this PR?

In contrary to @jonahbron, I don't think it is rendered moot by #40. By using service=trueI now (0.6.0 version) indeed get types and stubs for my RPC calls, but the files have an import {grpc} from "grpc-web-client". I am using the vanilla grpc dependency without any additional libraries (as it already has node.js support).

The readme has a Generating gRPC Service Stubs for use with grpc-web entry but what about `Generating gRPC Service Stubs for use with vanilla-grpc``

Everything is working so far except that I cannot use the created service.* files due to not having the grpc-web-client dependency in my project. I could add a post-build step to remove the code I don't need, but I'd rather not go down that rabbit hole.

@jonnyreeves
Copy link
Contributor

@Junkern is correct, #40 generates service stubs for grpc-web, not google's own NodeJS grpc library.

This diff is going to require quite a lot of effort to get it rebased following a couple of extensive refactors (in particular #40 and #51) however I do see the benefit of having ts-protoc-gen output these typescript definitions.

I'm pretty busy at the moment and don't have a lot of time to contribute, is there anyone reading that would be in a position to pick this PR up, please?

@foxdavidj
Copy link
Author

Unfortunately, I wont have time to make the necessary changes (added tests and some refactoring) anytime soon. Quite swamped atm.

@Junkern
Copy link
Contributor

Junkern commented May 23, 2018

I could do it, as I want to have this anyway ;) Should I rework the current PR or start a new one (clean state....)? @jonnyreeves

@jonnyreeves
Copy link
Contributor

jonnyreeves commented May 23, 2018 via email

@Junkern
Copy link
Contributor

Junkern commented May 24, 2018

FIY: #69 has landed, so I will start working on this

@jonnyreeves
Copy link
Contributor

Closing in favour of #75

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants