TypeScript Playground
Transpile TypeScript and run it in your browser with live console output, interactive input and coding examples.
TypeScript code
Monaco offers word suggestions (Ctrl + Space), plus JavaScript/TypeScript syntax and type diagnostics. Other languages have limited suggestions; check errors after Run. Suggestions need Monaco.
Console
Timing measures elapsed time, not CPU time; waiting for input is included. WASM memory, when available, is linear memory capacity, not total RAM or peak usage.
Output streams live, including timers. Use await prompt('Your name?') for interactive input. Runs in a Web Worker, without direct DOM access. Stop terminates execution; execution outside input waits is limited to 30 seconds, each answer can wait up to 2 minutes, and output is capped at 500 rows. Code can still make network requests, so only run code you trust. The tool does not save or upload your code or input.
Runtime details
The TypeScript 5.9.3 compiler downloads from jsDelivr on your first Run. This runner transpiles code and reports syntax errors; it does not perform semantic type-checking. Monaco's editor diagnostics are separate from execution. No Node.js or package imports.
Learn
About this tool
Transpile TypeScript 5.9.3 to JavaScript and run it in a disposable browser Worker. The console shows logs, return values and errors. The compiler loads from jsDelivr only on Run or when Auto-run is enabled; Monaco loads separately on demand. Examples cover arithmetic, prime numbers, sorting, classes and pyramid patterns, plus TypeScript interfaces and generics. Transpilation reports syntax errors but does not perform semantic type-checking. The tool does not save or upload code or prompt answers; snippets can still make network requests.Questions
- Does this check TypeScript types?
- No. The runner uses transpileModule, which removes types and reports syntactic errors. A mismatched type can still run. Monaco may display additional editor diagnostics when enabled, but the runner does not enforce them.
- Can I use await and interactive input?
- Yes. The transpiled snippet runs inside an async function. Use await prompt(‘Question’) and answer in the console with Enter. EOF (or Ctrl + D) returns null. Ask one question at a time; return displays a result.
- Does clicking an example run it?
- No. Selecting immediately replaces code and pauses Auto-run. If the editor contains more than one line, confirm deletion of existing code or cancel to keep it. Press Run to execute the example.
- Can I import npm packages?
- No. This is a single-snippet browser runner, not Node.js or a project bundler. document and window are also unavailable inside the Worker.
- What happens when code never finishes?
- Stop terminates the Worker. Runtime loading has a 90-second timeout, and execution outside input waits has a separate 30-second limit. Each answer may wait up to 2 minutes. Output is capped at 500 rows; input remains available to edit.