Hello, World!
const message: string = "Hello, World!";
console.log(message);Tap Run to execute
main.ts · output appears here
Press Run to execute
Output streams here as your program runs.
TypeScript is a statically typed superset of JavaScript developed by Microsoft and first released in 2012, led by Anders Hejlsberg. It adds optional static types, interfaces, generics, and enums on top of standard JavaScript, catching many errors at compile time. TypeScript code is transpiled to plain JavaScript, so any valid JavaScript is also valid TypeScript, making adoption incremental.
Today TypeScript is the default choice for large-scale JavaScript projects, widely used in front-end frameworks like Angular and React and in Node.js backends. Its tooling enables rich editor autocompletion, safe refactoring, and self-documenting code. On this compiler, TypeScript 5.9.3 is used to type-check and compile your code, which then runs on the Node.js runtime, so console output and Node modules behave the same as in plain Node.
main.ts is the entry point. Add helper files from the explorer and import them into your project.
Use the Input panel to pipe standard input to your program when it needs data.
Run sends your code to a fresh hosted runtime and streams the result into the output panel.
Your draft stays in this browser, and Share creates a separate snapshot link.
main.ts imports a typed export from helper.ts.
import { answer } from "./helper";
console.log(answer());
export function answer(): number {
return 42;
}
const message: string = "Hello, World!";
console.log(message);function greet(name: string): string {
return `Hello, ${name}!`;
}
console.log(greet("Ada"));interface User {
name: string;
age: number;
}
const users: User[] = [{ name: "Ada", age: 30 }];
users.forEach(u => console.log(u.name, u.age));function first<T>(items: T[]): T | undefined {
return items[0];
}
console.log(first<number>([10, 20, 30]));function parse(s: string): number {
const n = Number(s);
if (Number.isNaN(n)) {
throw new Error(`Invalid number: ${s}`);
}
return n;
}
try {
console.log(parse("abc"));
} catch (err) {
console.error((err as Error).message);
}const counts = new Map<string, number>();
for (const ch of "banana") {
counts.set(ch, (counts.get(ch) ?? 0) + 1);
}
for (const [ch, n] of counts) {
console.log(ch, n);
}enum Color { Red, Green, Blue }
type Id = string | number;
function describe(id: Id): string {
return typeof id === "string" ? `name ${id}` : `num ${id}`;
}
console.log(Color.Green, describe(42));class Person {
constructor(public name: string, public age: number) {}
}
const people: Person[] = [new Person("Ada", 36), new Person("Bob", 28)];
people.sort((a, b) => a.age - b.age);
people.forEach(p => console.log(p.name, p.age));interface Box<T> {
value: T;
}
function unwrap<T>(b: Box<T>): T {
return b.value;
}
const b: Box<number> = { value: 42 };
console.log(unwrap(b));type Shape =
| { kind: "circle"; r: number }
| { kind: "square"; side: number };
function area(s: Shape): number {
switch (s.kind) {
case "circle": return Math.PI * s.r * s.r;
case "square": return s.side * s.side;
}
}
console.log(area({ kind: "square", side: 3 }));The editor uses Monaco, the engine behind VS Code, with language-aware editing tools and familiar keyboard controls.
Type or paste your code into the editor, then click Run (or press Ctrl/Cmd + Enter) to execute it.
Output streams into the console panel, including runtime errors, exit status, and execution time.
Nothing to install and no account to create — code runs in an isolated hosted runtime.
Language-aware autocomplete and IntelliSense suggestions where the editor has a matching language service
Syntax highlighting, with native compiler and runtime errors shown in the console
Bracket matching, auto-indentation, code folding, and a minimap
Multi-cursor editing plus find & replace (Ctrl/Cmd + F)
Full undo/redo history and copy to clipboard
Built on Monaco — the same editor that powers VS Code
Run on demand, or turn on Auto-run to execute on every change
Stop long-running or infinite programs at any time
A real console shows standard output, errors, exit status, and execution time
Pass standard input (stdin) to your program from the Input panel — one value per line
Switch between light and dark themes
Adjust font size and other editor settings
Toggle side-by-side or top/bottom layouts
Enter distraction-free fullscreen mode
Generate a shareable link to your exact code in one click — no login needed
Your work autosaves to your browser, so you can pick up where you left off
Copy the active file to your clipboard
Run code: Ctrl/Cmd + Enter
Find & replace: Ctrl/Cmd + F
Open the full shortcut list from the keyboard icon in the toolbar
TypeScript is one of 23 linked-project compilers. Run always starts main.ts; selecting a helper tab changes what you edit, not the entry file.
main.ts imports a typed export from helper.ts.
Linked-project languages (23): Node.js, TypeScript, Deno, Python, C, Go, Dart, Swift, Rust, Ruby, PHP, Java, Kotlin, C++, C#, Nim, Crystal, Haxe, Zig, Scala, D, Bun, Objective-C.
Single-file scratchpads (46): Matplotlib, NumPy, pandas, Haskell, Clojure, Perl, Lua, Tcl, jq, Raku, Elixir, Bash, Zsh, Nushell, R, Assembly (NASM), Julia, Octave, Groovy, PowerShell, Visual Basic .NET, Odin, Pascal, Lisp, Erlang, CoffeeScript, COBOL, BASIC, V, Racket, OCaml, Prolog, AWK, Emacs Lisp, Emojicode, Forth, F#, Fortran, Assembly (NASM64), Solidity, Mojo, Ada, WASM (WAT), Gleam, Shell Script (sh), Scheme. Their extra project files are not submitted to the runtime.
Download project exports every TypeScript tab and a README in one ZIP archive.