fix: format of typescript definition#1463
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! 😃 |
https://www.typescriptlang.org/docs/handbook/enums.html
Before
After