Skip to main content

TypeScript

1. Basics

  • What is TypeScript? Why use it?
  • Setting up TypeScript (tsc, tsconfig.json)
  • Type Annotations
    • string, number, boolean
    • null, undefined, void, never
  • Type Inference
  • Union & Intersection Types
  • Type Aliases

2. Functions

  • Function Annotations
  • Optional & Default Parameters
  • Rest Parameters
  • Function Overloading
  • this in functions

3. Objects & Interfaces

  • Object Type Annotations
  • Interfaces
  • Extending Interfaces
  • Readonly properties
  • Optional properties
  • Index Signatures

4. Advanced Types

  • Literal Types
  • Type Narrowing
    • typeof, instanceof, type guards
  • Discriminated Unions
  • Mapped Types
  • Conditional Types
  • Utility Types (Partial, Pick, Omit, Record, etc.)

5. Generics

  • Generic Functions
  • Generic Interfaces
  • Generic Classes
  • Constraints with extends
  • Default Generic Types

6. Modules & Namespaces

  • Import Styles
  • Namespaces (legacy, but good to know)

7. Type Declarations

  • Ambient Declarations (.d.ts files)
  • Using DefinitelyTyped (@types/...)
  • Declaring types for external libraries

8. Advanced Features

  • Decorators (Class, Method, Property, Parameter)
  • Mixins
  • keyof, typeof, infer
  • Template Literal Types
  • Indexed Access Types

9. Practical Topics

  • Working with JSON & APIs
  • Type Assertions vs Type Casting
  • Non-null Assertion Operator !
  • Strict Mode (strictNullChecks, etc.)
  • Using TypeScript with Node.js