Correctness

Type safety

Catching 'you passed the wrong kind of data' mistakes before the code ever runs.

With type safety you declare that a function expects a number, an email string, or a User object, and the tools flag it the instant you pass something else — in your editor, before a user ever hits a crash. Think of it as a spellchecker for the shape of your data: `getUser(userId)` won't let you accidentally pass the whole user object instead of its id. This matters enormously when building with AI, because types act as guardrails — the model invents fewer wrong field names, and when it does, TypeScript underlines them immediately.

Related terms