Type Inference
TypeScript infers types from values, so you often do not need annotations. Annotate function parameters and public APIs.
Example
let x = 10;
const s = "hi";
const list = [1, 2, 3];
console.log(typeof x, typeof s, list.length);Result
number string 3
Exercise
Hover shows the type.
let n = ;
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.