TS Editor
iwantcoding.com ships an in-browser TypeScript editor. The official TypeScript compiler loads from a CDN, transpiles your code to JavaScript, and runs the result — all client-side.
Open the TypeScript Editor »
Opens in this tab. Use the browser Back button to return.
What you can do
- Write any modern TypeScript — types, generics, classes, interfaces, enums, async, decorators (stage 3).
- See type errors surfaced before the code runs.
- Get
console.log/console.warn/console.errorin the output pane. - Use modern JS APIs —
fetch,Promise,JSON,Math,Date,Set,Map,URL. - Pick from sample programs in the toolbar dropdown.
How it works under the hood
- You write TS in the editor.
- Press Run — the official
typescriptnpm package (loaded from jsDelivr) transpiles to JavaScript. - Type errors appear in the output pane in red.
- The transpiled JS runs in a sandboxed iframe.
console.login the iframe streams back to the output pane.
Sample to try
TS
type Shape =
| { kind: 'circle'; r: number }
| { kind: 'rect'; w: number; h: number };
function area(s: Shape) {
switch (s.kind) {
case 'circle': return Math.PI * s.r ** 2;
case 'rect': return s.w * s.h;
}
}
console.log(area({ kind: 'circle', r: 5 }));
Keyboard shortcuts
| Shortcut | Does |
|---|---|
| Ctrl+Enter | Run the code. |
| Tab | Indent (2 spaces). |
| Clear output | Empty the output panel. |
Tip: The editor uses the same compiler you'd
npm install in a real project. If something works here, it works there.Example
Example
// This editor compiles TypeScript in the browser // using the official TypeScript compiler, then runs the JS. // // Type errors are surfaced before the code runs. const greeting: string = 'Hello, TypeScript!'; console.log(greeting);Try it Yourself »
Exercise
Editor pane that shows console.log output.
Six letters.
Discussion
Loading…