Установка

Установка Node.js

// Windows
choco install -y nodejs.install

// macOS
brew install node

Установка TypeScript

npm install -g typescript
yarn global add typescript
pnpm add -g typescript

# Обновление
npm update -g typescript

# Проверка версии
tsc -v

Hello World

  1. Создай директорию HelloWorld
  2. Создай файл hello.ts
  3. Напиши код:
let message: string = 'Hello World'
console.log(message)
  1. Скомпилируй: tsc hello.ts
  2. Запусти: node hello.js
ℹ️ Компиляция

Компиляция создаёт .js файл из TypeScript. Перекомпилируй после каждого изменения, или используй Nodemon или режим наблюдения tsc --watch.