|
|
|
|
|
by elnygren
1774 days ago
|
|
The point of the switch-case is to mimic pattern matching and TS is smart enough tell you whether you handled all cases. Would you prefer that it's a if-elseif-else based structure instead? I guess that would work too but I feel like it could be easier to write it in a way where you accidentally forget to handle some case (since your else / last return is a potential catch-all). I personally don't mind switch-case because I'm so accustomed to it in ReasonML/ReScript already. |
|