This repo contains notes and exercises from my deep dive into TypeScript and I learn by doing the lessons from the The definitive guide to TypeScript book.
A little context
I am a polyglot programmer. Over the 10+ years, I have written codes both professionally and as a hobby in many programming languages—from Ruby to JavaScript, Go, Java, and Python. My motivation of learning TypeScript is to improved code quality as I have been writing a lot of JavaScript code since 2013 in my role as a front-end developer, hybrid mobile app developer, and React Native mobile app developer.
TypeScript is JavaScript that scales.
TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. Any browser. Any host. Any OS. Open source.
There are two main goals of TypeScript:
- Provide an optional type system for JavaScript.
- Provide planned features from future JavaScript editions to current JavaScript engines.
The desire for these goals is motivated below.
Types have proven ability to enhance code quality and understandability. Specifically:
- Types increase your agility when doing refactoring. It's better for the compiler to catch errors than to have things fail at runtime.
- Types are one of the best forms of documentation you can have. The function signature is a theorem and the function body is the proof.
However types have a way of being unnecessarily ceremonious. TypeScript is very particular about keeping the barrier to entry as low as possible. Here's how:
- Your JavaScript is TypeScript
- Types can be implicit
- Types can be explicit
- Types are structural
- Type errors do not prevent JavaScript emit
- Types can be ambient
- Future JavaScript => Now
WIP. Please check again soon.
Thank you for your interest.