Dong Nguyen I don't disagree per se. I just thing it's curious that you assert the validation inside of your code not before hand. Or in other words with types you can at least have type tests already done beforehand. The overhead is ofc bigger such is the nature of being explicit and not implicit but at least you don't have to do structural unitests for assertions.
The overhead ofc is a trade off but for me having unitests are about the functionality and not about the interface contracts. In js you can validate the contracts inside hence you don't need the types but refactoring and such is a lot easier esp with ambiguity in the structural interfaces :)
Anyhow you're right you can just unitest all structures which is basically using types without having any benefit of the typed strategy.
j
stuff ;)
nope it's a good thing. you could use typescript as well. Depends on what you feel more comfortable with. flow has the advantage it's more flexible.