Closed chandan192 closed 2 years ago
Thanks, great idea! Converting if-else to switch has been on my list for a while. Do you have a reference to the lint rule? The conversion only makes sense in certain cases.
Please see this image for reference.
@chandan192 I've just released version 1.61, which supports converting if-else to switch. Thanks for the suggestion!
Hi @lgrammel, Hope you are doing well.
refactoring if-else to switch case doesn't work for if condition with && or || operation.
@chandan192 thanks for the bug report. I'll look into adding support for ||
. It is not clear to me how to translate &&
into a switch, do you have an example?
@lgrammel, you are right, I didn't think of the condition with &&. But we can have support for ||.
Fixed in 1.64.2 - thanks for the bug report!
Can we have an option to convert if else if to switch case?
I am using tslint but it only shows the linting but does not refactors it.