TypeScript NotesRohit’s interview study guide
Try it

Playground

Write or paste any TypeScript and press Run (or ⌘↩). The real TypeScript compiler checks it first, then it runs in your browser, offline too, and prints the way Node does. What you type stays on this device. Every example in the chapters has the same Run and Edit buttons.

playground.ts
// Your playground: write or paste any TypeScript, then press Run (or ⌘↩).
// The real compiler checks the types first, then the code runs in your browser.
type User = { name: string; age?: number };

function greet(user: User): string {
  return `Hi ${user.name}${user.age ? `, you're ${user.age}` : ""}`;
}

console.log(greet({ name: "Rohit" }));
console.log(greet({ name: "Ana", age: 30 }));
// greet({ nam: "typo" }); // delete the // at the start to see a type error

Browser only: Node’s own modules (fs, http, process) aren’t here. An endless loop is stopped after 30 seconds, or press Stop.

Sync progress across devices

Type the same private phrase on your Mac and your phone, and your Learned ticks follow you between them — on every study site.

The phrase never leaves this device: only a fingerprint of it is sent, and the server stores a fingerprint of that. Anyone who knows the phrase could see or change your ticks, so pick something you don’t use elsewhere.

Sync is on in this browser.

Sync ID

This ID must be the same on every device. If another device shows a different one, its phrase is different (capital letters count): tap “Turn off here” on it and type the phrase again exactly.