TS: "We have added types to javascript, everything is now strongly typed, and the compiler will pester you to no end until it's happy with the types." Me: "Awesome, so I get an object from an API, it will be trivial to check at runtime if it's of a given type. Or to have a debug mode that checks each function's inputs to match the declared types. Otherwise the types would be just an empty charade. Right?" TS: "What?"…
That isn’t what TypeScript is for, you’re describing a similar but unrelated problem, namely runtime type validation. There’s a reason why JSON.parse() returns any. However. TS allows to avoid logical errors in the program's source, which is a class of errors historically very important, since JavaScript is so highly dynamic. The debug mode sounds interesting at first thought, but quickly explodes in complexity when…
I don't think so. I just added typia's is* checks to places where I am digesting a json input, it was rather trivial, and now I can actually trust for the first time that the object I am holding actually matches the declared type.
> "You can’t make things idiot proof"
I just did. You can't have a non-idiot-proof program running in the wild and blindly trusting the outputs of whatever API it uses.