The direct answer to the question is no. But it can help you to remove a big number of type-related errors.
The next question is what type-related errors are? It can be as simple as 1 + "!", or we can make the wrong state irrepresentable with the help of types than type checker will help you remove some state errors as well.
The direct answer to the question is no. But it can help you to remove a big number of type-related errors.
The next question is what type-related errors are? It can be as simple as
1 + "!"
, or we can make the wrong state irrepresentable with the help of types than type checker will help you remove some state errors as well.Type checker can prevent
See this article which compares tests and types.
As well I need to mention that TS isn't sound, so it won't prevent all type errors (sad).
I treat TS as just one more tool in my toolbelt, together with unit tests, integration tests (cypress), screenshot diffing tests etc.
Well said 👌
I really like the way you pointed out what a type check can prevent and the tests vs. types.