Hello, World

The smallest TypeScript program: it is type-checked, compiled to JavaScript and run with Node.js.

Runs in Zerethon IDE · TypeScript 7 Official TypeScript documentation ↗
main.ts
const greeting: string = 'Hello, World!';
console.log(greeting);
console.log('Sum:', 2 + 3);

Output

Hello, World!
Sum: 5

Every Run first type-checks all .ts files of the project. If there is a type error, nothing runs: the Output tab shows the compiler's messages instead.

  • Types exist only while checking — at run time the program is plain JavaScript.
  • Everything in the JavaScript reference applies; TypeScript adds types on top.