-
Notifications
You must be signed in to change notification settings - Fork 773
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
Generate Typescript definition for top level Enums #404
Conversation
Thanks for the great contributions! Yea looks like this is a gap that we need to address. On the other hand, I'd like to start requesting contributors to also add tests for features they added. We already have some tests - running This PR will fit in to something like https://github.com/grpc/grpc-web/blob/master/packages/grpc-web/test/plugin_test.js. In that test, we assume the Let's do something similar and add a test for this Enum feature. Thanks! |
@stanley-cheung Totally agree that we should have tests for this. |
I am also hoping someone from the community can give us some advice on how's best to test TS code generation. Quick thought: perhaps we can |
Looking at the TS protoc generator Improbable has written, it seems they generate the files and just check properties on the generated types: https://github.com/improbable-eng/ts-protoc-gen/blob/master/test/integration/service/grpcweb.ts. |
From what I understand this would still just test the properties on the compiled JavaScript and not the actual TypeScript file itself; it just looks that way because the test itself is in TypeScript and can import the definition. |
I plead ignorance, I just wanted to point to the Improbable repo as a possible source for inspiration for writing tests for this repo :). |
So... I've added a basic test to make sure the TypeScript can compile. I manually tested The thing is, we can't test any output from the TypeScript to validate as this is only a definition file and the actual JS is already generated 💁♂️. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for adding the tests!
Awesome work you guys are doing. I'm currently using JS web-grpc but I'm looking forward to switching to TS. I'm waiting for this fix to be released so I can do so. Sorry if this is the wrong place to ask but do you know when the next release is scheduled for? |
Fixes #403