Why TypeScript
JavaScript is flexible.
Flexible means it lets you mix many kinds of things.
Sometimes that causes bugs.
TypeScript finds many bugs while you write.
Bugs that hide until later
In plain JavaScript, wrong values can sneak in.
You might stick a string where a number belongs.
A string is text. A number is a count.
The bug shows up only when someone hits that path.
Catch mistakes before they run
TypeScript checks your code first.
That check is called compile time.
Compile time means before the program runs.
Runtime means while the program is running.
Better help in your editor
Types teach your editor what is allowed.
Autocomplete can list real property names.
A property is a labeled slot on an object.
An object is a bag of named values.
Easier renames
When you rename a thing, types help tools find every use.
That is safer than search and replace by eye.
Hover a value and you can see its type.
When teams grow
In a tiny solo script, you might remember everything.
In a shared project, types act like sticky notes.
They tell the next person what to pass in.
They also tell what comes back out.
Use TypeScript when you want clearer, safer code with fewer surprise bugs.
Test yourself
Three quick questions made just for this lesson. Earn 10 XP per correct answer.