Welcome to the hands-on TypeScript learning environment!
Instead of reading long documentation, you'll learn by doing. Each lesson is a .ts file in src/lessons/ filled with explanations, examples, and challenges.
- JavaScript developers looking to add type safety to their projects.
- Frontend devs working with React, Vue, or Angular.
- Anyone who wants a quick, interactive way to learn TypeScript fundamentals.
To get started, make sure you have Node.js installed, then follow these steps:
-
Install Dependencies:
npm install
-
Run a Lesson: Each lesson has a dedicated NPM script. For example, to run the first lesson:
npm run lesson:01
We recommend going through them in order:
- Lesson 01: Introduction to TypeScript
- Lesson 02: Basic Types (string, number, boolean, any, unknown)
- Lesson 03: Arrays and Tuples
- Lesson 04: Objects and Type Inference
- Lesson 05: Functions in TypeScript
- Lesson 06: Advanced Function Types (Overloads, void, never)
- Lesson 07: Type Aliases
- Lesson 08: Union and Intersection Types
- Lesson 09: Type Narrowing (typeof, in, instanceof)
- Lesson 10: Literal Types (UI State management)
- Lesson 11: Interfaces
- Lesson 12: Generics (The key to reusable code)
- Lesson 13: Utility Types (Partial, Pick, Omit, Record)
- Lesson 14: Enums
- Lesson 15: Type Assertions (as)
- Lesson 16: Modules in TypeScript
- Lesson 17: Classes in TypeScript
- Lesson 18: Advanced Types (keyof, mapped types)
- Lesson 19: Working with Third-Party Libraries (@types)
- Lesson 20: TypeScript in Real Frontend Projects
Each file follows a standard format:
- Lesson Title & Goal: What you'll achieve.
- Concept Explanation: Short and punchy.
- Basic Example: The "Hello World" of the concept.
- Real Frontend Example: How it's used in the wild.
- Common Mistakes: What to watch out for.
- Practice Challenges: Your turn to write code!
We want to make this the best TypeScript resource for beginners!
- Found a bug? Open an issue.
- Want to help? Check out our Contributing Guide.
- Suggestions? We'd love to hear your ideas for new lessons or better examples!
Happy Coding! 💻