Lying to TypeScript for Fun and Profit

2 · Kevin Cox · March 21, 2023, 9:38 p.m.
I’ve been writing a lot more TypeScript recently and have been pleasantly surprised. It mostly negates the downsides of JavaScript and creates a fairly pleasant programming environment.One interesting thing about TypeScript is that it feels that there is a weaker bond between the compile-time types and run-time types than in most other programming languages. For example TypeScript considers the following code perfectly legitimate.let data = JSON.parse("{}"); data.achieveWorldPeace(); This is bec...