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. This is 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, and your progress syncs across the web and the CoddyKit app. The TypeScript Academy course includes 3 lessons in total.
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.
Learn TypeScript with an AI tutor — free
Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.
- Courses
- 101
- Lessons
- 352
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. 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. The TypeScript Academy course includes 3 lessons in total.
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, so you can start here or from the beginning and move at your own pace. This is lesson 2 of 3.
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)