iwantcoding.com
🔥 Daily 👥 Rooms 🏆 Top Log in Sign up

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.error in 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

  1. You write TS in the editor.
  2. Press Run — the official typescript npm package (loaded from jsDelivr) transpiles to JavaScript.
  3. Type errors appear in the output pane in red.
  4. The transpiled JS runs in a sandboxed iframe.
  5. console.log in 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

ShortcutDoes
Ctrl+EnterRun the code.
TabIndent (2 spaces).
Clear outputEmpty 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.

Test yourself

Q1. The editor transpiles in…
Q2. Type errors are…
Q3. Ctrl+Enter…

Discussion

Loading…