Skip to main content
← TypeScript Lesson 2 / 4

The Checker Already Knows

You don't have to label every variable in TypeScript. The compiler reads your code and figures out the types on its own. Click a variable to see what it guessed — and watch how const guesses a tighter type than let.

Hover a line to reveal its type

The name line: let ⟷ const

Flip it and re-reveal the name line to watch its guessed type change.

Notice: nobody wrote : number or : string anywhere. The checker worked it out from the values.

What the checker inferred

let count hidden
const name hidden
let items hidden
const user hidden
function double hidden

Why const guesses tighter

const can't be reassigned, so TS infers the EXACT value as the type — a "literal type" (here "ada"). let could be reassigned later, so it widens the guess to string.

Right now the name line uses const → inferred type "ada".

The checker is reasoning about your code everywhere — even on the lines where you wrote no types at all.