| > Over the years, the type system of TypeScript has grown from basic type annotations to a large and complex programming language. Give someone (particularly a developer) the opportunity to build something complicated and undoubtedly they will. So now you have two problems, the complicated program that actually does some hopefully useful work, and another complicated program on top of it that fills your head and slows you down when trying to fix the first complicated program. You may say 'ah yes, but the second complicated program validates the first!'. Not really, it just makes things more complicated. Almost all bugs are logic bugs or inconsistent state bugs (thanks OOP!), almost none are type bugs. However, static analysis of existing code (in Javascript), without having to write a single extra character, may well have great value in indicating correctness. Edit: > TypeScript's type system is a full-fledged programming language in itself! Run! Run as fast as you can! Note that this 'full-fledged programming language' doesn't actually do anything (to their credit they admit this later on) Edit2: > [...] is a type-level unit test. It won't type-check until you find the correct solution. > I sometimes use @ts-expect-error comments when I want to check that an invalid input is rejected by the type-checker. @ts-expect-error only type-checks if the next line does not! What new level of hell are we exploring now?? I am genuinely afraid and I'm only halfway through this thing. What's next? A meta type level language to check that our type checking checks?? > 3. Objects & Records > COMING SOON! > this chapter hasn't been published yet. Thank God, I am saved. |