An ordered set of instructions. It reads input, follows rules, and produces output.
Workspace
TypeScript
typed JavaScript for product scale
Definition first
What TypeScript means
TypeScript is a programming language for writing exact instructions, often used for typed JavaScript for product scale. Start with one mental model: input goes through steps and becomes output.
app.tsRun tsc app.ts && node app.jsHabit Let the type error teach the missing contractA value is data. A variable is the name you use to hold and reuse that data.
A named piece of work. It takes input, does one job, and can return a result.
TypeScript compiler then Node.js is the place that actually runs code from app.ts.
First readable code
Typed values
string number boolean array objectconst name: string = "Ada"; console.log(name);
Output AdaLanguage lineage
TypeScript family tree
See where TypeScript comes from, which languages feel close, and what to learn next.
large JavaScript products where refactors and API contracts matter
Zero base path
Question bank
Search before practice
Pick a stage or search across the open programming bank. Jump straight to the matching drill.
TypeScript practice 1
TypeScript question 1. Choose the statement that matches type annotation.
TypeScript practice 2
TypeScript question 2. Choose the statement that matches interface shape.
TypeScript practice 3
TypeScript question 3. Choose the statement that matches union narrowing.
TypeScript practice 4
TypeScript question 4. Choose the statement that matches generic array.
TypeScript practice 5
TypeScript question 5. Choose the statement that matches type annotation.
TypeScript practice 6
TypeScript question 6. Choose the statement that matches interface shape.
TypeScript practice 7
TypeScript question 7. Choose the statement that matches union narrowing.
TypeScript practice 8
TypeScript question 8. Choose the statement that matches generic array.
TypeScript practice 9
TypeScript question 9. Choose the statement that matches type annotation.
TypeScript practice 10
TypeScript question 10. Choose the statement that matches interface shape.
TypeScript practice 11
TypeScript question 11. Choose the statement that matches union narrowing.
TypeScript practice 12
TypeScript question 12. Choose the statement that matches generic array.
TypeScript practice 13
TypeScript question 13. Choose the statement that matches type annotation.
TypeScript practice 14
TypeScript question 14. Choose the statement that matches interface shape.
TypeScript practice 15
TypeScript question 15. Choose the statement that matches union narrowing.
TypeScript practice 16
TypeScript question 16. Choose the statement that matches generic array.
TypeScript practice 17
TypeScript question 17. Choose the statement that matches type annotation.
TypeScript practice 18
TypeScript question 18. Choose the statement that matches interface shape.
Multiple choice
TypeScript practice 1
TypeScript question 1. Choose the statement that matches type annotation.
const age: number = 18;
Reference
Patterns for app.ts
tsc app.ts && node app.jsstring number boolean array object
Typed values
const name: string = "Ada"; console.log(name);
- Type public data shapes
- Let local inference work
- Fix red squiggles early
object contracts reusable shapes
Interfaces
interface User { name: string }
const user: User = { name: "Ada" };
console.log(user.name);- Interfaces describe object shape
- Prefer exact fields
- Use readable names
unknown union guard safe access
Narrowing
function label(x: string | number) {
return typeof x === "string" ? x.toUpperCase() : x + 1;
}- Check before using
- Use typeof and in
- Avoid any when learning