Primitives and Type Inference

Learn how TypeScript understands primitive values and automatically infers types to make your code safer without requiring extra syntax.

Let’s clarify immediately: TypeScript isn’t about forcing you to add types to everything. One of the most powerful things it does is infer types for you automatically and behind the scenes without getting in your way. That’s called type inference, one of TypeScript’s superpowers.

When we write let score = 100;, TypeScript sees the value and says, “Got it. That’s a number.” No annotation is needed. Clean, readable, and safe.