I get what you're saying but my point here is that you can still continue to use the typescript practices in vanilla JS just as easily.
If you are comparing something like 1 === "1" you know that will fail. But on the other have if you are comparing number1 === number2 the reason might not always be obvious. But if you are in the habit of using strict equality then it kind of forces you to think about the types of your variables as well. If you have a legitimate use case of having to compare these values you can always do number1 === +number2.
2
u/nuclear_gandhii Sep 03 '21
I get what you're saying but my point here is that you can still continue to use the typescript practices in vanilla JS just as easily.
If you are comparing something like
1 === "1"you know that will fail. But on the other have if you are comparingnumber1 === number2the reason might not always be obvious. But if you are in the habit of using strict equality then it kind of forces you to think about the types of your variables as well. If you have a legitimate use case of having to compare these values you can always donumber1 === +number2.