« Back to TypeScript Tutorial
TypeScript Editor
— official compiler, in-browser
Sample programs…
Clear output
Clear code
Run »
Loading TypeScript compiler…
|
Tip:
Ctrl
+
Enter
to run
TYPESCRIPT
// Welcome to the iwantcoding.com TypeScript playground. // The official TypeScript compiler runs in your browser, transpiles // to JS, then executes in a sandboxed iframe — console output goes here. type Status = 'paid' | 'pending' | 'refunded'; function describe(s: Status): string { switch (s) { case 'paid': return 'OK'; case 'pending': return 'Awaiting'; case 'refunded': return 'Refund issued'; } } const orders: Status[] = ['paid', 'pending', 'refunded']; for (const o of orders) { console.log(`${o.padEnd(10)} -> ${describe(o)}`); }
OUTPUT
Compile errors and console.log output will appear here.