Learn TypeScript Fundamentals in 5 Steps

Learn TypeScript Fundamentals in 5 Steps

🧰

Instant Toolkit

2 artifacts

📋
Step-by-Step Guide

1

Install Node.js and TypeScript

  1. Download and install Node.js from nodejs.org (LTS version).

  2. Verify installation:

npm --version
node --version
  1. Create a project folder and initialize:
mkdir ts-learn
cd ts-learn
npm init -y
npm install -D typescript@latest
  1. Create greeter.ts:
function greeter(person: string) {
  return `Hello, ${person}`;
}

const user = "Jane User";
console.log(greeter(user));
  1. Compile:
npx tsc greeter.ts
node greeter.js
  1. Add tsconfig.json:
npx tsc --init

Edit to include "strict": true.

Why this step matters:
  • -Establishes a reliable workflow for writing and compiling TS code
  • -Prepares you for scalable projects mimicking real development setups
30-60 minutes
Node.js, npm, VS Code, Terminal
$0
Definition of Done
  • tsc compiles .ts to .js without errors
  • node runs the output JS successfully
  • tsconfig.json is created and configured
Common Mistakes to Avoid

Using global install for projects

Install locally with `npm install -D typescript` for version control

Skipping tsconfig.json

Run `npx tsc --init` to enable strict mode

2

Following along, or just reading? 👀

Spin up a personalized “learn TypeScript” plan you can save, check off, and return to anytime — unlimited on the free trial.

Start free trial →
3
4
5