3 ms·
It actually does disallow various type coercion operations that you can do in JS, even when they're arguably useful. For example `1 == "1"` doesn't typecheck:
by alangpierce 8y ago
It actually does disallow various type coercion operations that you can do in JS, even when they're arguably useful. For example `1 == "1"` doesn't typecheck:
https://www.typescriptlang.org/play/index.html#src=const%20x%3A%20number%20%3D%201%3B%0D%0Aconst%20s%3A%20string%20%3D%20'1'%3B%0D%0Aconsole.log(x%20%3D%3D%20s)%3B https://www.typescriptlang.org/play/index.html#src=const%20x...
So while there are still things like truthy/falsy values, the type system is stronger (not just static) in some sense compared with JS.