-
Notifications
You must be signed in to change notification settings - Fork 791
fix: format of typescript definition #1463
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
Conversation
@nnnnoel thanks for help fixing the style!! One request: Do you mind sharing the before v.s. after view of the generated code? Thanks! |
@sampajano I shared by PR Comment, Please see the syntax changes and check the removed space after open bracket in enum! |
@nnnnoel Thank you very much for providing this diff! Looks very clear! 😃 However, I've noticed that this PR not only changed format, but also changed the generated "enum" -> "const enum". From what I read on the link you provided, there are difference in behaviors between them — "Const enums can only use constant enum expressions and unlike regular enums they are completely removed during compilation." I wonder if some of our clients might be relying on the old format and can potentially be broken by this change? |
Thanks for read docs @sampajano . It has breaking change when use enum as enum key, but the typescript enum's bi-directional bind spec is not valid in grpc protocol serializer spec. |
@nnnnoel Ahh i see! Thanks for explaining! That makes sense! But could you elaborate a bit further on what you mean by "typescript enum's bi-directional bind spec is not valid in grpc protocol serializer spec."? Could you give me a quick example maybe? Sorry for the trouble but I want to understand a bit better before introducing a potentially breaking change 😃 |
Before var key = RefreshTokenResponseStatus[RefreshTokenResponseStatus.REFRESH_TOKEN_SUCCESS]
// ^ "REFRESH_TOKEN_SUCCESS" After var key = RefreshTokenResponseStatus[RefreshTokenResponseStatus.REFRESH_TOKEN_SUCCESS]
// ^ TypeError |
@nnnnoel Got it!! Thanks SO much for the clarification! Makes perfect sense now! Thank you again for your contribution and patience! 😃 |
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.
Thanks again!! 😊
https://www.typescriptlang.org/docs/handbook/enums.html
Before
After