Lesson 1: JavaScript vs TypeScript
The everyday picture
Think of a recipe. JavaScript is a recipe that says "add some sugar". TypeScript is the same recipe that says "add 2 spoons of sugar", plus a checker who reads the whole recipe before you start cooking and says "line 14 asks for 2 spoons of salt where sugar should be. Are you sure?"
What it really is
- JavaScript is the language every web browser understands. It also runs on servers through Node.js.
- TypeScript is JavaScript with labels added. You label what kind of thing each piece of data is: a number, some text, a list of customers.
- A checker reads those labels and warns you about mistakes before the program ever runs.
- Browsers can't read TypeScript. So before it runs, it is turned back into plain JavaScript and the labels are removed. TypeScript only exists to help while you build.
A tiny example:
let price: number = 100; // "price is a number"
price = "one hundred"; // the checker stops you: text is not a number
In plain JavaScript that second line is allowed, and the mistake shows up later as a wrong bill.
What it means for your idea
Small mistakes like this are exactly the kind AI makes when it writes code quickly. With TypeScript, the checker catches many of them for you, even if you can't read every line yourself. That makes TypeScript one of the best safety nets a non-coder building with AI can have.
Pick this when...
- JavaScript: tiny scripts, quick experiments, a single web page.
- TypeScript: anything with more than a few files, anything that handles money or customer data, and anything AI is writing for you.
Quick check
Your app shows a total of "100200" instead of 300. What would TypeScript most likely have done? It would most likely have warned that text was being added to a number, before the app was ever used.
Goes deeper in Modules 17–30.