What is TypeScript?
TypeScript adds labels to JavaScript that say what shape each value should be, so a typo or a missing field is flagged before users ever see it. Why that matters even more when an agent writes the code.

Key takeaways
- TypeScript is a superset of JavaScript from Microsoft that adds types and compiles to plain JavaScript.
- Types catch whole classes of bugs before the app runs: typos in field names, missing values, wrong argument shapes.
- Type checks are a fast, automatic safety net for AI-written code; they do not replace testing what the app actually does.
Microsoft released TypeScript in 2012 as JavaScript plus types: labels that say what kind of value each variable, function input and data object should hold. A checker reads those labels and flags mistakes, such as a misspelled field or a missing argument, before the code ever runs. The output is plain JavaScript, so it works anywhere JavaScript does.
An everyday example: the shape sorter
A toddler's shape sorter will not let a square block go through the star hole. You find out at once, not after the box is sealed. Plain JavaScript is a box with one big hole: anything goes in, and the problem shows up later when something downstream breaks. TypeScript cuts the holes to shape. Pass a price as the text "18" where a number was expected, and the editor underlines it immediately.
What types look like
A type describes the shape of your data. For a booking app:
`type Booking = { id: string; customerId: string; startsAt: Date; status: 'pending' | 'confirmed' | 'cancelled'; notes?: string }`
Now the checker knows a booking's status can only be one of three words, that `notes` might be missing (the question mark), and that `startsAt` is a date. Write `booking.staus` and it fails. Write `status: 'canceled'` with one L and it fails. Forget to handle the missing-notes case and it warns you. Each of those would otherwise be a bug a user finds.
What it catches, and what it does not
- Catches: typos in names, calling a function with the wrong inputs, using a value that might be empty, forgetting a case when you add a new status, renames that miss one file.
- Does not catch: wrong business logic (charging the wrong amount with the right type), data from outside that lies about its shape, layout problems, slow queries.
The last gap matters: TypeScript trusts what you tell it about incoming data. Data from an API, a form or a database should still be checked at the boundary, often with a validation library.
Why it matters when building with Startbase
Both Startbase starting points use TypeScript: websites start from Vite, React and TypeScript, and mobile apps from Expo, React Native and TypeScript (web template, Expo template). Before the agent finishes a turn, it runs your app's checks (TypeScript and lint, plus a real production build for web apps and games) and fixes any errors it finds, then runs them again. Types give an agent the same benefit they give a person: when a change in one file breaks another, the checker says so right away instead of a user finding it later.
Add a "no-show" status to bookings. Update the shared Booking type, the database, the status badge colors, the staff filter and the monthly report so every place that handles booking status covers the new value. Run the type check and tell me every file you changed.
For what checks can and cannot prove, see is AI-generated code safe? and what is React.
Common confusions
- TypeScript does not run in the browser directly. It is compiled to JavaScript first; the types disappear at that step.
- Types are not tests. A function can be perfectly typed and still return the wrong answer.
- You can adopt it gradually. JavaScript files and TypeScript files live together in one project.
Frequently asked questions
Is TypeScript harder than JavaScript?
Slightly more to write at first, then usually less work overall, because editors autocomplete fields and catch mistakes as you type.
Does TypeScript make my app faster?
No. It compiles to the same JavaScript. Its value is fewer bugs and safer changes, not runtime speed.

