Belajar TypeScript dari Nol

Lesson 1
10 min

Pengenalan TypeScript

TypeScript adalah JavaScript dengan superpowers.

Apa itu TypeScript?

TypeScript adalah superset JavaScript yang menambahkan:

  • Static type checking
  • Modern JavaScript features
  • Better tooling dan IDE support

Iklan

Instalasi

# Install TypeScript globally npm install -g typescript # Cek versi tsc --version # Install di project npm install --save-dev typescript

Kompilasi

# Compile single file tsc hello.ts # Watch mode tsc --watch hello.ts # Dengan config tsc --init tsc

File Pertama

// hello.ts const message: string = "Hello, TypeScript!"; console.log(message);

Iklan