4 ms·
This is not something that other dynamically typed languages necessarily do Yes, I agree, and this is because Javascript is very weakly typed, and sadly, no to
by flavio81 9y ago
This is not something that other dynamically typed languages necessarily do
Yes, I agree, and this is because Javascript is very weakly typed, and sadly, no tool like Typescript will go so far in counteracting this, because the runtime itself (JS) is still weakly typed.
So... no real substitute for good old runtime testing, i'd say.
- neurotrace 9y agoExcept that a strong static type system wouldn't allow you to write code like this in the first place. You wouldn't hit these issues at run-time because you caught them at compile-time.
- mikewhy 9y agoSay you have an API endpoint: router.post('/users', (req, res) => { const body = req.body as MyEndpointInterface }) If someone posts to that endpoint with the wrong interface, you're still going to have problems. I'm not sure of any language that would catch such a thing at compile-time and not need some sort of test.