3 ms·
Most static languages only have compile-time type checking, because storing and checking runtime type information is usually not worth the cost. The problem wit
by tadfisher 4y ago
Most static languages only have compile-time type checking, because storing and checking runtime type information is usually not worth the cost. The problem with your example is the deserializer, which in a static language would be generated and include those runtime checks. I'm sure something like this exists for Typescript, it's too common a problem not to have been solved.
- tomohawk 4y agoIn Go, can I declare a Foo, and deserialize into it, but instead of a Foo, it is a Bar? No. Typescript also doesn't catch cases where metaprograming is used when calling a function. You can put anything you want in there.