All cheatsheetsOpen TypeScript editor

TypeScript Online Compiler

Write, Run & Share TypeScript code online using CodeCompiler's free online TS editor. TypeScript is a typed superset of JavaScript developed by Microsoft.

About TypeScript

TypeScript adds static type definitions to JavaScript, helping you catch bugs early and making code easier to refactor.

Hello World

const greet = (name: string): string => `Hello, ${name}!`;
console.log(greet("World"));

Interfaces

interface User {
  name: string;
  age: number;
}
const u: User = { name: "Alice", age: 30 };