4 ms·
Why do you want TypeScript to check types at run time? Integration with other JavaScript code?
by pspeter3 12y ago
Why do you want TypeScript to check types at run time? Integration with other JavaScript code?
- mjibson 12y agoValidation of JSON responses is the big win.
- programminggeek 12y agoI am a big fan of design by contract. (http://retromocha.com/obvious/ http://retromocha.com/obvious/) I don't trust user input in any form, including the database. So, while a system like TypeScript that checks types in the code is fantastic, it doesn't check types in the input, which is how a lot of problems happen in the first place. Seriously, just import one legacy dataset into your system or have to work with some JSON api, and all of a sudden you can't trust that the data is valid, correctly typed, or even sane. Doing proper validation of types and data integrity at any input point can save you a whole category of sadly common bugs. That includes data coming out of any data source you use, like a database. Runtime type checking is another tool to make validated data a common, sane thing.