A comprehensive, hands-on TypeScript learning repository covering everything from basic types to advanced patterns, React integration, and Node.js backend development.
Welcome to your complete TypeScript learning journey! This repository is designed to take you from TypeScript beginner to advanced developer through practical, real-world examples and structured learning paths.
This repository covers everything you need to become proficient in TypeScript:
- β Core TypeScript Fundamentals - Master the building blocks
- β Intermediate Concepts - Object-oriented programming, interfaces, and advanced patterns
- β Advanced Type System - Generics, conditional types, utility types, and type-level programming
- β React + TypeScript - Build type-safe, scalable frontend applications
- β Node.js + TypeScript - Create robust backend services and APIs
Learning TypeScript/
βββ π src/
β βββ π 1-core-types/ # TypeScript Fundamentals
β β βββ 01-primitives.ts # Basic types (string, number, boolean)
β β βββ 02-arrays-tuples.ts # Collections and fixed arrays
β β βββ 03-enums.ts # Enumeration types
β β βββ 04-objects.ts # Object typing and interfaces
β β βββ 05-functions.ts # Function signatures and overloads
β β βββ 06-union-types.ts # Multiple possible types
β β βββ 07-type-guards.ts # Runtime type checking
β β βββ 08-intersection-types.ts # Combining types
β β βββ 09-literal-types.ts # Exact values as types
β β βββ 10-type-inference.ts # Automatic type detection
β β βββ 11-type-assertions.ts # Manual type casting
β β βββ 12-never-type.ts # Impossible values
β β βββ 13-typeof-keyof.ts # Type operators
β β βββ π notes.md # Detailed explanations
β β βββ π README.md # Section guide
β β βββ π recap.md # Key takeaways
β β βββ π quiz-answers.md # Practice solutions
β β
β βββ π 2-intermediate-types/ # Intermediate Concepts
β β βββ 01-type-aliases.ts # Custom type definitions
β β βββ 02-interfaces.ts # Contract definitions
β β βββ 03-aliases-vs-interfaces.ts # When to use each
β β βββ π 04-oop/ # Object-Oriented Programming
β β β βββ 01-classes-objects.ts
β β β βββ 02-constructors.ts
β β β βββ 03-this-keyword.ts
β β β βββ 04-access-modifiers.ts
β β β βββ 05-inheritance.ts
β β β βββ 06-getters-setters.ts
β β β βββ 07-static-members.ts
β β β βββ 08-abstract-classes.ts
β β β βββ 09-oop-patterns.ts
β β β βββπ oop-notes.md # Detailed explanations
β β β βββπ README.md # Section guide
β β β βββπ recap.md # Key takeaways
β β βββ 05-method-overloading.ts
β β βββ 06-function-overloading.ts
β β βββ 07-namespaces.ts
β β βββ 08-modules.ts
β β βββ 09-index-signatures.ts
β β βββ 10-optional-readonly.ts
β β βββ 11-unknown-vs-any.ts
β β βββ 12-satisfies-operator.ts
β β βββ 13-declaration-merging.ts
β β βββ π notes.md # Detailed explanations
β β βββ π README.md # Section guide
β β βββ π recap.md # Key takeaways
β β βββ π quiz-answers.md # Practice solutions
β β
β βββ π 3-advanced-types/ # Advanced Type System
β β βββ 01-type-narrowing.ts # Smart type refinement
β β βββ 02-generics.ts # Reusable type parameters
β β βββ 03-conditional-types.ts # Type-level conditionals
β β βββ 04-infer-keyword.ts # Type inference in conditions
β β βββ 05-discriminated-unions.ts # Tagged unions
β β βββ 06-mapped-types.ts # Transform existing types
β β βββ 07-key-remapping.ts # Advanced key manipulation
β β βββ 08-template-literal-types.ts # String type manipulation
β β βββ 09-utility-types.ts # Built-in helper types
β β βββ 10-type-level-functions.ts # Complex type operations
β β βββ 11-branded-types.ts # Nominal typing patterns
β β βββ 12-recursive-types.ts # Self-referencing types
β β βββ π notes.md # Detailed explanations
β β βββ π README.md # Section guide
β β βββ π recap.md # Key takeaways
β β βββ π quiz-answers.md # Practice solutions
β β
β βββ π 4-typescript-in-react/ # React + TypeScript
β β βββ π react-playground/ # Live React examples
β β β βββ src/
β β β β βββ components/ # Typed React components
β β β β βββ concepts/ # Learning modules
β β β β β βββ 01-props-and-state/
β β β β β βββ 02-events-and-forms/
β β β β β βββ 03-hooks-and-refs/
β β β β β βββ 04-context-api/
β β β β β βββ 05-custom-hooks-generics/
β β β β β βββ 06-component-composition/
β β β β β βββ 07-typing-external-data/
β β β β β βββ 08-practical-ui-types/
β β β β βββ App.tsx
β β β βββ package.json # React dependencies
β β β βββ vite.config.ts # Vite configuration
β β βββ π notes.md # Detailed explanations
β β βββ π README.md # Section guide
β β βββ π recap.md # Key takeaways
β β βββ π quiz-answers.md # Practice solutions
β β
β βββ π 5-typescript-in-node/ # Node.js + TypeScript
β β βββ src/
| | | βββ 01-basic-types.ts # Node.js type basics
β β | βββ 02-modules-and-esm.ts # Module systems
β β | βββ 03-working-with-fs.ts # File system operations
β β | βββ 04-node-builtins.ts # Built-in modules
β β | βββ 05-type-safe-env.ts # Environment variables
β β | βββ 06-simple-server.ts # HTTP server basics
β β | βββ 07-express-basics.ts # Express.js with TypeScript
β β | βββ 08-error-handling.ts # Type-safe error handling
β β | βββ 09-routing.ts # Route typing
β β | βββ 10-controllers-and-services.ts
β β | βββ 11-middlewares.ts # Middleware typing
β β | βββ 12-global-types.ts # Global type definitions
β β | βββ 13-api-response-types.ts # API response typing
β β | βββ 14-utils-and-helpers.ts # Utility functions
β β | βββ 15-auth-jwt.ts # Authentication patterns
β β | βββ 16-testing-basics.test.ts # Testing with TypeScript
β β βββ π notes.md # Detailed explanations
β β βββ π README.md # Section guide
β β βββ π recap.md # Key takeaways
β β βββ π quiz-answers.md # Practice solutions
β β
βββ π package.json # Project dependencies
βββ π tsconfig.json # TypeScript configuration
βββ π README.md # This guide
- Node.js 18+ - Download here
- Basic JavaScript knowledge - ES6+ features
- Code editor - VS Code recommended with TypeScript extensions
-
Clone the repository
git clone https://github.com/pranav89624/Learn-Typescript.git cd Learn-Typescript
-
Install dependencies
npm install
-
Verify TypeScript installation
npx tsc --version
Option 1: Compile and Run
# Compile all TypeScript files
npm run build
# Run a specific compiled file
node dist/1-core-types/01-primitives.js
Option 2: Direct TypeScript Execution
# Install ts-node globally (optional)
npm install -g ts-node
# Run TypeScript files directly
npx ts-node src/1-core-types/01-primitives.ts
Option 3: Watch Mode
# Automatically recompile on changes
npm run watch
Path: src/1-core-types/
Begin your TypeScript journey with fundamental concepts:
- Basic types and type annotations
- Arrays, tuples, and enums
- Object and function typing
- Union and intersection types
- Type inference and assertions
Goal: Understand TypeScript syntax and basic type system
Path: src/2-intermediate-types/
Advance to more complex patterns:
- Interfaces vs type aliases
- Object-oriented programming in TypeScript
- Function and method overloading
- Modules and namespaces
- Advanced type modifiers
Goal: Write maintainable, object-oriented TypeScript code
Path: src/3-advanced-types/
Master the advanced type system:
- Generic programming
- Conditional and mapped types
- Template literal types
- Utility types and type manipulation
- Type-level programming
Goal: Create flexible, reusable type-safe abstractions
Path: src/4-typescript-in-react/
Apply TypeScript to frontend development:
- Component and prop typing
- Hooks and context with TypeScript
- Event handling and forms
- Custom hooks and composition patterns
- External API integration
Goal: Build production-ready React applications
Path: src/5-typescript-in-node/
Develop backend services with TypeScript:
- Node.js built-ins and modules
- Express.js with type safety
- API design and error handling
- Authentication and middleware
- Testing strategies
Goal: Create robust backend services and APIs
- Follow the numbered sequence - Each section builds upon previous concepts
- Read the README first - Each folder has a detailed guide
- Study the notes - Every section includes comprehensive explanations
- Practice actively - Modify examples and create your own variations
- Test yourself - Use the quiz files to verify understanding
- Modular curriculum - Each section can be taught independently
- Progressive complexity - Concepts build naturally
- Real-world examples - Practical, applicable code samples
- Assessment materials - Built-in quizzes and exercises
- Quick lookup - Well-organized, searchable content
- Copy-paste friendly - Production-ready code patterns
- Best practices - Industry-standard approaches
- Common pitfalls - Warnings about frequent mistakes
{
"compilerOptions": {
"target": "ES6", // Modern JavaScript output
"module": "commonjs", // Node.js compatibility
"strict": true, // Maximum type safety
"outDir": "./dist", // Compiled output directory
"rootDir": "./src", // Source code location
"esModuleInterop": true, // Module interoperability
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"strictNullChecks": true, // Prevent null/undefined errors
"lib": ["ES2017", "DOM"] // Available APIs
},
"include": ["src/**/*"] // Files to compile
}
{
"scripts": {
"build": "tsc", // Compile TypeScript to JavaScript
"start": "tsc && node dist/index.js", // Build and run
"watch": "tsc --watch" // Auto-recompile on changes
}
}
- Start with the basics - Don't skip fundamental concepts
- Practice regularly - Consistency beats intensity
- Experiment freely - Modify examples to test understanding
- Read error messages - TypeScript errors are educational
- Use strict mode - Learn proper TypeScript from the start
- β Using
any
type everywhere - defeats the purpose of TypeScript - β Ignoring compiler errors - they prevent runtime bugs
- β Not reading the notes - context and explanations are crucial
- β Rushing through sections - understanding > speed
- β Avoiding strict mode - makes learning harder later
# Check types without compiling
npx tsc --noEmit
# See detailed error information
npx tsc --listFiles --explainFiles
# Generate declaration files for learning
npx tsc --declaration --emitDeclarationOnly
- π Comprehensive Coverage - Everything from basics to advanced patterns
- π― Practical Examples - Real-world, applicable code samples
- π Extensive Documentation - Detailed notes and explanations for every concept
- π Progressive Structure - Each concept builds naturally on previous ones
- βοΈ Framework Integration - Specific sections for React and Node.js
- β Self-Assessment - Quizzes and exercises to test understanding
- π οΈ Production Ready - Industry-standard configurations and practices
- π± Beginner Friendly - Clear explanations without assuming prior knowledge
- TypeScript Handbook - Official TypeScript documentation
- TypeScript Playground - Online TypeScript editor
- TypeScript Discord - Community discussions
- r/typescript - Reddit community
- Stack Overflow - Q&A
- Type Challenges - Advanced type puzzles
- TypeScript Deep Dive - Comprehensive guide
- Effective TypeScript - Best practices book
We welcome contributions to improve this learning resource!
- π Bug Reports - Found an error? Open an issue
- π‘ Suggestions - Ideas for new examples or explanations
- π Documentation - Improve existing notes and guides
- π§ Code Examples - Add more practical examples
- π― Exercises - Create additional practice problems
- Fork the repository
- Create a new branch (
git checkout -b feature
) - Make your changes with clear commit messages
- Test your code changes
- Submit a pull request with a detailed description
For detailed steps visit CONTRIBUTING.md.
This project is licensed under the MIT License - see the LICENSE file for details.
- β Free to use for personal and commercial projects
- β Modify and distribute as needed
- β No warranty - use at your own discretion
- β Attribution appreciated but not required
Pranav Verma
- GitHub: @pranav89624
- LinkedIn: Pranav Verma
- X/Twitter: @pranav89624
- Dev.to: @pranav89624
- TypeScript Team - For creating an amazing language
- Open Source Projects - For inspiration and examples
β Star this repository if you find it helpful!
π Start Learning Now β’ π Browse Examples β’ π¬ Get Help
Happy coding and enjoy your TypeScript learning journey! π