4 ms·
Most static type systems do not force you to say what’s the entire shape of the data, just what the shape of the data you need is. In fact its a good practice
by seer 6y ago
Most static type systems do not force you to say what’s the entire shape of the data, just what the shape of the data you need is.
In fact its a good practice to do in general. So that when processing the json blob you tell what only your processing requires.
What you get is that if for example you do your validation, but then by chance you touch more data that you’ve checked for, the types will tell you you are dangerous waters, and you can go update the validations.
This is especially useful if you’re not the original author or if you’ve written it several months back and don’t remember the details.
Static types are really cool that way, and can be treated as just a faster to write and faster to run and always up to date unit test.