TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. TypeScript provides better error checking than JavaScript. This is because TypeScript uses a static type system, which means that the type of a variable is checked before the code is executed.
We just published a 5-hour TypeScript course for beginners on the freeCodeCamp.org YouTube channel.
Hitesh Choudhary will teach you everything you need to know to get started with TypeScript. Hitesh has a YouTube channel with 750,000 subscribers and has created over 1000 tutorials.
Here are a few reasons you may want to use TypeScript instead of JavaScript:
- TypeScript provides better error checking than JavaScript. This is because TypeScript uses a static type system, which means that the type of a variable is checked before the code is executed.
- TypeScript can be used to develop large-scale JavaScript applications. The type system and the compiler help to organize the code and to catch errors early.
- TypeScript code can be easily ported to other languages that support JavaScript, such as CoffeeScript or Dart.
The course has the following sections:
- Why to learn TypeScript
- TypeScript is not what you think
- How to install TypeScript
- Your first intro to TypeScript docs
- Number, boolean, and type inference
- Number, boolean, and type inference
- Don't use ANY
- Do you really know functions
- A better way to write function
- Bad behavior of objects
- Type Aliases
- READONLY and optional
- Array
- Union Types in TS
- Tuples
- Enums
- interface
- Interface vs Type
- How to setup Typescript for real projects
- Classes
- Private Public
- Getters and Setters
- Protected
- Why Interface is important
- Abstract class
- Generics
- Generics in Array and Arrow functions
- Generic Classes
- Type Narrowing
- The in operator narrowing
- Instanceof and Type Predicates
- Discriminated Union and Exhaustiveness Checking with never
- TypeScript End
Watch the full course on the freeCodeCamp.org YouTube channel (5-hour watch).