Install Node & TypeScript (npm i -D typescript), tsc --init
Install Node.js, add TypeScript via npm, and create a tsconfig.json using tsc --init.
Install Node & TypeScript (npm i -D typescript), tsc --init is a free TypeScript Academy lesson on CoddyKit — lesson 2 of 3. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the TypeScript Academy learning path, one of 3 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Install Node
Prerequisite: Install Node.js (LTS recommended). It provides npm (package manager) and node (runtime), which TypeScript builds on.
npm init
Create a project folder and initialize with npm init -y. This gives you a package.json to manage dependencies and scripts.
Install TS
Install TypeScript as a devDependency so teammates share the same version. Verify with npx tsc --version.
// Run in your terminal (not in TS code)
npm install --save-dev typescript
// Verify installation
npx tsc --versiontsc --init
tsc --init creates tsconfig.json, which controls compiler options, file includes, and output structure.
// Run once per project
npx tsc --init
// This creates tsconfig.json with many commented optionstsconfig.json basics
You can tune compilerOptions in tsconfig. Common keys: target, module, strict, and outDir.
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"strict": true,
"outDir": "dist"
}
}Benefits of tsconfig
Why tsconfig? Ensures consistent builds, enforces strictness, and allows editors to provide better IntelliSense. Shared config avoids surprises across dev machines.
Init check
Quick check: What does tsc --init do?
Recap & next
Recap: Installed Node.js, added TypeScript locally, and ran tsc --init to create tsconfig.json. Next: compile and run your first program.
Frequently asked questions
Is the “Install Node & TypeScript (npm i -D typescript), tsc --init” lesson free?
Yes — the full text of “Install Node & TypeScript (npm i -D typescript), tsc --init” is free to read here on the web, and the TypeScript Academy course includes 3 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the TypeScript Academy course, upgrade to CoddyKit PRO.
What will I learn in “Install Node & TypeScript (npm i -D typescript), tsc --init”?
Install Node.js, add TypeScript via npm, and create a tsconfig.json using tsc --init. You practise TypeScript Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start TypeScript Academy?
No prior experience is required. TypeScript Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 3, so you can start here or from the beginning and move at your own pace.
How long does the “Install Node & TypeScript (npm i -D typescript), tsc --init” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this TypeScript Academy lesson?
Yes. Every TypeScript Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- What is TypeScript? Benefits & use cases
- Install Node & TypeScript (npm i -D typescript), tsc --init
- First Program & Build/Run (tsc + node / tsx)