[BUG][typescript-rxjs] Fix nully type coalescing in Configuration getters#5329
Conversation
- eliminate nully "" (empty string) value via conditional check
- use concrete "string" type in typeof check
("function" may be returned for Object types
|
👍 Thanks for opening this issue! The team will review the labels and make any necessary changes. |
|
Closest I've came up with when trying to come up with a prior issue is #4027 but that concerns the overall typings and not the getters which seem to be specific to the RxJS template. |
|
@ermik looks like you need to re-generate samples from and commit the changed files |
- run the script for updating all petstores ./bin/typescript-rxjs-petstore-all.sh
|
@amakhrov I have run the script you've pointed out to me and committed the changes it has triggered. Thank you for helping out with this. |
…ters (OpenAPITools#5329) * [typescript-rxjs] fix coalescing in Configuration - eliminate nully "" (empty string) value via conditional check - use concrete "string" type in typeof check ("function" may be returned for Object types * [typescript-rxjs] update petstore sample * run petstore-all - run the script for updating all petstores ./bin/typescript-rxjs-petstore-all.sh
|
@ermik thanks for the PR, which has been included in the 4.3.0 release: https://twitter.com/oas_generator/status/1243455743937789952 |
With Typescript 3.7.5 the
runtime.tstemplate output produces the following error:referring to the coalescing of the null
""JS value in the following lines:openapi-generator/modules/openapi-generator/src/main/resources/typescript-rxjs/runtime.mustache
Line 39 in 118b5e7
openapi-generator/modules/openapi-generator/src/main/resources/typescript-rxjs/runtime.mustache
Line 44 in 118b5e7
Additionally, the
typeof accessToken === 'function'check opens the discussion about polymorphism, while checking against"string"is more obvious — thus capturing the string half of the union type and leaving the rest of it to the TS inference to make sense of.PR checklist
./bin/(or Windows batch scripts under.\bin\windows) to update Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit, and these must match the expectations made by your contribution. You only need to run./bin/{LANG}-petstore.sh,./bin/openapi3/{LANG}-petstore.shif updating the code or mustache templates for a language ({LANG}) (e.g. php, ruby, python, etc).master,4.3.x,5.0.x. Default:master.@TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @nicokoenig (2018/09) @topce (2018/10) @akehir (2019/07) @petejohansonxo (2019/11) @amakhrov (2020/02)