Skip to main content

Introduction to TypeScript

Type Inference

0:00
LearnStep 1/2

Automatic Type Detection

Type Inference

TypeScript can automatically infer types based on values, so you don't always need explicit annotations.

typescript

When to Add Annotations

  • Function parameters (always recommended)
  • Function return types (for documentation)
  • Variables initialized later
  • When inference isn't what you want
typescript