Type inference
If you don't provide the type, TS understands it automatically.
Syntax
let name = value; // type automatic
Description
If you initialize with a value, TypeScript infers the type itself. let x = 5 → x becomes number; later x = 'a' throws an ERROR.
Example
Loading editor…
Expected output
number
When to use?
Avoid writing redundant types; TS already knows.