RUN

TypeScript Online Compiler

Write, type-check and run TypeScript in your browser. Free, no sign-up.

main.ts

// Welcome to the CodingHumans TypeScript compiler.
// Press Run (or Ctrl + Enter). Type errors are shown before your code runs.

interface User {
  name: string;
  skills: string[];
}

const name = prompt("What's your name?") || 'CodingHumans';
const user: User = { name, skills: ['TypeScript', 'React'] };

function greet(u: User): string {
  return `Hello, ${u.name}! You know ${u.skills.join(' and ')}.`;
}

console.log(greet(user));
Output

Press Run to see the output.

TypeScript examples to try

How to run TypeScript online

  1. Write or paste your TypeScript code in the editor.
  2. Press Run, or Ctrl + Enter (Cmd + Enter on a Mac).
  3. If there are type errors, fix the lines they point to and run again.
  4. Press Share to copy a short link to your code. Anyone who opens it sees exactly what you wrote.

About this TypeScript compiler

This free TypeScript compiler uses the official TypeScript compiler (version 5.9) in your browser. It checks your types first, in strict mode, and shows each error with the line and a marker under the problem, just like tsc. If there are no errors, the compiled JavaScript runs straight away.

Modern TypeScript works: interfaces, generics, union types, enums, classes, async/await and top-level await. console.log, console.table and prompt() work like they do in JavaScript.

Your code runs in a separate background thread. If a loop never ends, press Stop to interrupt it without losing your code.

Frequently asked questions

›Is this TypeScript compiler free?

Yes. It is free with no sign-up and no run limits. Your code is compiled and run in your own browser, which is what keeps it free.

›Does it check types?

Yes. It runs the full TypeScript type checker in strict mode before running your code. If there are errors, it shows them and does not run, the same as tsc with errors stopping the build.

›Which TypeScript version is it?

TypeScript 5.9, targeting ES2022. Top-level await works without any setup.

›Can I import npm packages?

Not yet. Each program is a single file. The JavaScript standard library is available, but browser-only and Node-only APIs such as document or require("fs") are not.

›Why is the first run slower?

The first time, your browser downloads the TypeScript compiler. It is cached after that, so later runs start in a moment.