0
TypeScript · Introduction to TypeScript
New technique
What is TypeScript?
Plain JavaScript is soft iron: it bends where you don't want it to. TypeScript tempers it into steel.
TypeScript is JavaScript with types. Made by Microsoft, it lets you write down what kind of value each variable holds, and checks that before your code runs.
Why bother? JavaScript happily calls a method on undefined, and you only find out when a user clicks the wrong button. TypeScript points at that line while you type it.
It's a superset of JavaScript: every valid JavaScript program is also valid TypeScript. You add types where they help.
- Catches mistakes while you write code, not when users click
- Gives your editor autocomplete, inline docs and safe renames
- Compiles down to plain JavaScript that runs anywhere