TypeScript 2 ๐ท Setting Up the Development Environment
Before writing any TypeScript, you need a working environment โ Node.js, npm, the TypeScript compiler, and a code editor that understands the language. This is a one-time investment, but it’s the foundation everything else builds on. Get it right and every subsequent step is smooth; get it wrong and you’ll spend hours chasing phantom errors that have nothing to do with your code.
Key point: TypeScript’s environment has three layers โ Node.js (the runtime that runs the tooling), the TypeScript compiler (which turns .ts into .js), and your editor (which surfaces errors as you type). All three need to be set up correctly. The compiler is what actually checks your types; the editor is just a convenient window into the same checks.
What you need
Four pieces, working together:
- Node.js โ the JavaScript runtime that runs the compiler, the package manager, and eventually your emitted JavaScript
- npm โ Node’s package manager; it installs TypeScript and every project dependency
- TypeScript โ the compiler itself, installed either globally or locally
- An editor โ VS Code is the standard choice, but any editor with TypeScript support works
You’ll also want a terminal โ VS Code’s built-in terminal, iTerm, Windows Terminal, or whatever shell you prefer. The commands below work in bash, zsh, PowerShell, and cmd with minor path differences.
The chain is:
Node.js โ npm โ typescript (tsc) โ your project
Each layer depends on the one above. Node brings npm. npm installs TypeScript. TypeScript compiles your code.
Why Node first: Node is the foundation for everything. Even if your TypeScript runs in the browser, the tooling runs on Node. The compiler, the build tools, the test runner โ all Node programs. Install it first, and the rest follows.
Step 1 โ Install Node.js
Download the LTS (Long-Term Support) version from https://nodejs.org/. LTS is the recommended track โ stable, supported for years, and matched to what the ecosystem expects.
What gets installed:
nodeโ the runtimenpmโ the package manager
Verify:
node --version
npm --version
Both should print version numbers. If you see command not found, the installer’s PATH additions didn’t take โ restart your terminal, or log out and back in.
Current minimum: TypeScript 5.x works on Node 14 and later. For new projects, use the current LTS โ usually Node 20 or 22.
Version managers: If you work on multiple projects that need different Node versions, install a version manager.
- macOS/Linux:
nvmโcurl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash - Windows:
nvm-windowsโ a separate project with a similar interface
With nvm, you can switch versions per project:
nvm install 20
nvm use 20
Why LTS and not Current: The “Current” version has the newest features but is more likely to break tooling. LTS versions are tested against the entire ecosystem โ the compiler, package managers, frameworks. For development work, LTS is almost always the right choice.
Step 2 โ Decide: global or local TypeScript
TypeScript can be installed globally (available everywhere on your machine) or locally (per-project, in node_modules).
Global install:
npm install -g typescript
Use tsc from any directory:
tsc --version
Local install (recommended for projects):
npm install --save-dev typescript
Then run through npx or npm scripts:
npx tsc --version
Which to choose:
| Approach | Best for |
|---|---|
| Global | Learning, quick scripts, one-off compilations |
| Local | Every real project โ pinned versions, reproducible builds |
Why local is preferred: Different projects may need different TypeScript versions. A project on TS 4.9 may not compile correctly with TS 5.4. Installing locally pins the version in package.json, so every developer and every CI run gets the same compiler. Global installs are convenient for learning but cause version drift in real projects.
Do both if you like: Install globally for one-off experiments, and install locally in every project for reproducible builds. They don’t conflict โ inside a project, npx tsc uses the local version; outside, tsc uses the global one.
Why the shift to local matters: Before npm made this trivial, every language had a “system compiler” problem โ one version for all projects, breaking when projects needed different versions. Node’s solution โ per-project
node_modulesโ solves it. The same pattern applies to TypeScript, ESLint, and every other tool.
Step 3 โ Verify the compiler
If installed globally:
tsc --version
If installed locally:
npx tsc --version
Both print something like:
Version 5.4.5
If you see a version, the compiler is ready. If you see command not found or npx: command not found, the install didn’t complete โ reinstall and check the PATH.
Check what the compiler can do:
tsc --help
Prints a list of flags. The most useful ones:
| Flag | Purpose |
|---|---|
--init | Create a tsconfig.json |
--watch | Recompile on file change |
--noEmit | Type-check only |
--project | Use a specific tsconfig.json |
--version | Show version |
--help | Show help |
Why verify: The compiler is the entire tool. If
tsc --versionworks, you’re 90% set up. Everything after this is configuration and workflow.
Step 4 โ Set up an editor
VS Code is the default recommendation. Install it, then check that it’s using the right TypeScript version.
Check the version VS Code uses:
- Open any
.tsfile - Open the Command Palette (
Cmd+Shift+Pon macOS,Ctrl+Shift+Pon Windows/Linux) - Run TypeScript: Select TypeScript Version
- Choose Use Workspace Version to use the project’s local TypeScript
VS Code ships with a bundled TypeScript version. For consistency, use the workspace version โ the one installed in your project’s node_modules. That way, the editor and tsc agree on what’s an error.
Recommended extensions:
| Extension | Purpose |
|---|---|
| ESLint | Lint TypeScript files |
| Prettier | Format code |
| Error Lens | Show errors inline |
| Path Intellisense | Autocomplete imports |
| TypeScript Vue Plugin | Vue + TS (if applicable) |
None are strictly required. VS Code’s built-in TypeScript support is already excellent โ the extensions just add convenience.
Other editors:
- WebStorm โ first-class TypeScript support out of the box
- Neovim / Vim โ via
nvim-lspconfigandtypescript-language-server - Sublime Text โ via the LSP package
Any editor with the TypeScript Language Server installed will give you autocomplete, go-to-definition, and inline errors.
Why the workspace version: The bundled version is whatever shipped with VS Code. Your project may need a different version. Selecting the workspace version aligns the editor with your build โ no more “the editor says it’s fine but
tscfails” surprises.
Step 5 โ Create your first project
A TypeScript project needs a package.json and a tsconfig.json. The first tracks dependencies and scripts; the second configures the compiler.
Initialize npm:
mkdir my-project
cd my-project
npm init -y
The -y accepts all defaults. You’ll get a package.json with placeholder fields.
Install TypeScript locally:
npm install --save-dev typescript
Initialize the compiler configuration:
npx tsc --init
This creates a tsconfig.json with comments explaining every option. By default, it enables strict: true (good) and targets a modern JavaScript version.
A minimal tsconfig.json:
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "Bundler",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"outDir": "dist",
"rootDir": "src"
},
"include": ["src"]
}
| Option | Purpose |
|---|---|
target | JS version to emit |
module | Module system for output |
moduleResolution | How imports are resolved |
strict | Enable all strict checks |
esModuleInterop | Smooth interop with CJS |
skipLibCheck | Skip .d.ts checking (faster) |
outDir | Where compiled JS goes |
rootDir | Where source lives |
Add scripts to package.json:
{
"scripts": {
"build": "tsc",
"watch": "tsc --watch",
"typecheck": "tsc --noEmit"
}
}
Write a file:
mkdir src
cat > src/index.ts << 'EOF'
function greet(name: string): string {
return `Hello, ${name}!`;
}
console.log(greet('Alice'));
EOF
Compile:
npm run build
Run the output:
node dist/index.js
You should see Hello, Alice!. The project is set up.
Why
rootDirandoutDir: By default,tscemits.jsfiles next to their.tssources. For a clean project, keep sources insrc/and build output indist/. That makes it clear what’s code and what’s generated โ and keepsdist/easily gitignored.
Step 6 โ Gitignore and project files
A TypeScript project should ignore build output and dependencies in Git.
.gitignore:
node_modules/
dist/
*.tsbuildinfo
.DS_Store
Commit these:
package.jsonpackage-lock.jsontsconfig.json- All
.tssource files
Ignore these:
node_modules/โ regenerated frompackage.jsondist/โ regenerated bytsc*.tsbuildinfoโ incremental build cache
Never edit node_modules. Install dependencies with npm and let the compiler find them.
Why the lockfile matters:
package-lock.jsonpins exact versions of every dependency, including transitive ones. Without it, two developers installing at different times can end up with different compilers. Commit it.
Step 7 โ Running TypeScript without pre-compiling
Sometimes you want to run a .ts file directly โ no build step, no dist/. Several tools make this possible.
tsx โ the modern standard:
npm install --save-dev tsx
npx tsx src/index.ts
tsx uses esbuild to strip types fast and runs the result. It’s what ts-node used to be, but faster and with fewer configuration problems.
ts-node โ the older standard:
npm install --save-dev ts-node
npx ts-node src/index.ts
ts-node compiles and runs in one step. Slower than tsx, more configuration-sensitive, but widely used.
Node’s native TypeScript support (experimental):
Recent Node versions can run .ts files directly:
node --experimental-strip-types src/index.ts
This strips types without transforming them โ no enums, no namespace, no decorators. Useful for scripts, not for full projects yet.
Which to use:
| Tool | Speed | Use case |
|---|---|---|
tsc + node | Slower | Production builds |
tsx | Fast | Development, scripts |
ts-node | Medium | Legacy projects |
| Node native | Fast | Simple scripts, no fancy syntax |
For most projects, tsx is the right choice for running during development, and tsc is the right choice for the production build. They can coexist.
Why not just use
tscfor everything:tscis a compiler, not a runner. Runningtsc && nodeon every edit is slow.tsxskips the full compile and just strips types โ much faster for the dev loop. The final build still goes throughtsc.
Step 8 โ Recommended project layout
A small, well-organized TypeScript project looks like this:
my-project/
โโโ node_modules/
โโโ src/
โ โโโ index.ts
โ โโโ utils.ts
โโโ dist/
โโโ package.json
โโโ package-lock.json
โโโ tsconfig.json
โโโ .gitignore
โโโ README.md
As the project grows, src/ gets subfolders โ components/, services/, utils/, types/. The build output in dist/ mirrors src/‘s structure.
What each file does:
| File | Role |
|---|---|
package.json | Dependencies and scripts |
package-lock.json | Exact versions |
tsconfig.json | Compiler configuration |
.gitignore | What not to commit |
src/ | Source .ts files |
dist/ | Compiled .js output |
node_modules/ | Installed packages |
Why this layout: It separates source from build output, keeps dependencies out of version control, and matches what virtually every TypeScript project looks like. Learning the shape once means you can navigate any project.
Global vs local โ a concrete comparison
Global install:
npm install -g typescript
tsc --version # 5.4.5
Problems: every project uses the same version. If one project was written for 4.9, it may not compile cleanly with 5.4.
Local install:
cd my-project
npm install --save-dev typescript
npx tsc --version # uses this project's version
Advantages: each project pins its own version. Upgrading one project doesn’t break another.
Both together:
tsc(global) for quick scripts you run outside any projectnpx tsc(local) for real projects
The global compiler never sees a project with a local one โ npx prefers the local version automatically.
Why this matters: Version drift is the most common cause of “it works on my machine.” Pinning per-project eliminates it. When the whole team installs from the same
package-lock.json, they get identical compilers.
A full example
Setting up a project from zero.
# ============================================
# PART 1: CREATE THE DIRECTORY
# ============================================
mkdir ts-demo
cd ts-demo
# ============================================
# PART 2: INITIALIZE NPM
# ============================================
npm init -y
# Wrote to package.json
# ============================================
# PART 3: INSTALL TYPESCRIPT
# ============================================
npm install --save-dev typescript
# added 1 package
# ============================================
# PART 4: CREATE TSCONFIG
# ============================================
npx tsc --init
# Created tsconfig.json
# ============================================
# PART 5: ADD SCRIPTS
# ============================================
# Edit package.json to add:
# "build": "tsc"
# "watch": "tsc --watch"
# "typecheck": "tsc --noEmit"
# ============================================
# PART 6: WRITE A PROGRAM
# ============================================
mkdir src
cat > src/index.ts << 'EOF'
interface User {
id: number;
name: string;
}
function greet(user: User): string {
return `Hello, ${user.name} (id ${user.id})!`;
}
const alice: User = { id: 1, name: 'Alice' };
console.log(greet(alice));
EOF
# ============================================
# PART 7: BUILD
# ============================================
npm run build
# dist/index.js created
# ============================================
# PART 8: RUN
# ============================================
node dist/index.js
# Hello, Alice (id 1)!
# ============================================
# PART 9: WATCH MODE
# ============================================
npm run watch
# Watching for file changes.
# Edit src/index.ts in another terminal
# โ dist/index.js updates automatically
# ============================================
# PART 10: TYPE-CHECK ONLY
# ============================================
npm run typecheck
# (no output โ no errors)
# ============================================
# PART 11: RUN DIRECTLY WITH TSX
# ============================================
npm install --save-dev tsx
npx tsx src/index.ts
# Hello, Alice (id 1)!
# ============================================
# PART 12: ADD .gitignore
# ============================================
cat > .gitignore << 'EOF'
node_modules/
dist/
*.tsbuildinfo
EOF
Quick Reference
Required Tools
| Tool | Purpose | Install |
|---|---|---|
| Node.js | Runtime for tooling | nodejs.org (LTS) |
| npm | Package manager | Ships with Node |
| TypeScript | Compiler | npm i -D typescript |
| VS Code | Editor | code.visualstudio.com |
Install Commands
| Command | Purpose |
|---|---|
npm install -g typescript | Global install |
npm install --save-dev typescript | Local install |
npm install --save-dev tsx | Fast runner |
npm install --save-dev ts-node | Older runner |
Compiler Commands
| Command | Purpose |
|---|---|
tsc --version | Show version |
tsc --init | Create tsconfig.json |
tsc | Compile per config |
tsc file.ts | Compile a single file |
tsc --watch | Watch and rebuild |
tsc --noEmit | Type-check only |
tsc --help | Show help |
Running Without Compiling
| Tool | Command |
|---|---|
tsx | npx tsx src/index.ts |
ts-node | npx ts-node src/index.ts |
| Node native | node --experimental-strip-types src/index.ts |
Global vs Local
| Aspect | Global | Local |
|---|---|---|
| Install | npm i -g typescript | npm i -D typescript |
| Command | tsc | npx tsc |
| Version | One for all projects | Per project |
| Reproducible | โ | โ |
| Recommended | For learning | For projects |
Project Layout
| Path | Contents |
|---|---|
src/ | .ts sources |
dist/ | Compiled .js |
node_modules/ | Dependencies |
package.json | Deps + scripts |
package-lock.json | Exact versions |
tsconfig.json | Compiler config |
.gitignore | Ignored files |
npm Scripts
| Script | Command |
|---|---|
build | tsc |
watch | tsc --watch |
typecheck | tsc --noEmit |
dev | tsx src/index.ts |
tsconfig Essentials
| Option | Recommended |
|---|---|
target | ES2022 |
module | ESNext or NodeNext |
moduleResolution | Bundler or NodeNext |
strict | true |
esModuleInterop | true |
skipLibCheck | true |
outDir | dist |
rootDir | src |
Best Practices
โ Do This:
# Install Node LTS
# Use nvm for multi-project work
nvm use 20 # โ
# Install TypeScript locally in every project
npm install --save-dev typescript # โ
# Use npx to run the local compiler
npx tsc --version # โ
# Commit tsconfig.json and package-lock.json
git add tsconfig.json package-lock.json # โ
# Keep source in src/, output in dist/
# Both in tsconfig and .gitignore # โ
# Enable strict mode
"strict": true # โ
# Use tsx for the dev loop
npm install --save-dev tsx # โ
# Type-check in CI
npx tsc --noEmit # โ
# Select the workspace TypeScript in VS Code
# Command Palette โ TypeScript: Select Version # โ
โ Don’t Do This:
# Don't rely on global TypeScript in real projects
tsc # โ ๏ธ version drift
# Don't commit node_modules or dist
git add node_modules dist # โ
# Don't edit node_modules by hand
nano node_modules/typescript/... # โ
# Don't skip the lockfile
# Remove package-lock.json # โ
# Don't run tsc on every edit in dev
tsc && node dist/index.js # โ ๏ธ slow โ use tsx
# Don't disable strict mode permanently
"strict": false # โ ๏ธ temporary at best
# Don't mix global and local configs
# Global tsc using project tsconfig # โ ๏ธ use npx
# Don't install Node "Current" for stable work
# Download the LTS version # โ
Common Pitfalls
| Pitfall | Problem | Solution |
|---|---|---|
tsc: command not found | Not installed or not on PATH | Reinstall, check PATH |
| Global vs local mismatch | Different versions | Use npx tsc in projects |
| Editor uses bundled version | Editor disagrees with build | Select workspace version |
No tsconfig.json | No project settings | Run tsc --init |
tsc emits next to source | Messy project | Set outDir and rootDir |
Forgetting --save-dev | TS in production deps | Always use --save-dev |
Running .ts with node | Syntax error | Use tsx or compile first |
| Missing lockfile | Version drift | Commit package-lock.json |
node_modules committed | Huge repo | Add to .gitignore |
Real-World Examples
1. Check Node
node --version
2. Check npm
npm --version
3. Install TypeScript globally
npm install -g typescript
4. Install TypeScript locally
npm install --save-dev typescript
5. Check the compiler
npx tsc --version
6. Initialize a project
npm init -y
npx tsc --init
7. Create a source file
mkdir src
echo 'console.log("hi")' > src/index.ts
8. Compile
npx tsc
9. Run the output
node dist/index.js
10. Watch mode
npx tsc --watch
11. Type-check without emitting
npx tsc --noEmit
12. Run directly with tsx
npx tsx src/index.ts
13. Run directly with ts-node
npx ts-node src/index.ts
14. Add a build script
"scripts": {
"build": "tsc",
"watch": "tsc --watch",
"typecheck": "tsc --noEmit"
}
15. Ignore build artifacts
node_modules/
dist/
*.tsbuildinfo
16. Select workspace TypeScript in VS Code
Command Palette โ TypeScript: Select TypeScript Version โ Use Workspace Version
17. Version manager
nvm install 20
nvm use 20
18. Check which tsc you’re using
which tsc # or `where tsc` on Windows
19. Check project TypeScript version
npx tsc --version
20. Create an empty tsconfig
npx tsc --init --rootDir src --outDir dist
Visual: The Toolchain
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Node.js โ
โ โ โ
โ โผ โ
โ npm โ
โ โ โ
โ โผ โ
โ typescript (tsc) โ
โ โ โ
โ โผ โ
โ Your project โ
โ โ
โ Each layer depends on the one above โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Visual: Global vs Local
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Global TypeScript โ
โ โ
โ /usr/local/lib/node_modules/typescript โ
โ โ
โ Command: tsc โ
โ One version for all projects โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Local TypeScript โ
โ โ
โ ./node_modules/typescript โ
โ โ
โ Command: npx tsc โ
โ Per-project version โ
โ Pinned in package.json โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Inside a project: โ
โ โ
โ npx tsc โ uses LOCAL version โ
โ tsc โ uses GLOBAL version โ
โ โ
โ Prefer npx in projects โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Visual: Compile Pipeline
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ src/index.ts โ
โ โ
โ interface User { ... } โ
โ function greet(u: User): string { ... } โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ tsc โ
โ โ
โ โข Type-check โ
โ โข Transform syntax โ
โ โข Erase types โ
โ โข Emit to dist/ โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ dist/index.js โ
โ โ
โ function greet(u) { ... } โ
โ โ
โ (plain JavaScript) โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ node dist/index.js โ
โ โ
โ โ Runs in the JS runtime โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Visual: Dev vs Build Loop
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Development loop (tsx) โ
โ โ
โ Edit .ts file โ
โ โ โ
โ โผ โ
โ tsx strips types, runs immediately โ
โ โ
โ Fast, no dist/ output โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Build loop (tsc) โ
โ โ
โ Edit .ts file โ
โ โ โ
โ โผ โ
โ tsc full type-check + emit โ
โ โ
โ Slower, produces dist/ for deployment โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CI (tsc --noEmit) โ
โ โ
โ Type-check only, no output โ
โ โ
โ Fast, catches errors before merge โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Visual: Project Structure
my-project/
โโโ node_modules/ โ installed deps (ignored)
โโโ src/ โ your .ts sources
โ โโโ index.ts
โ โโโ utils.ts
โโโ dist/ โ compiled .js (ignored)
โ โโโ index.js
โ โโโ utils.js
โโโ package.json โ deps + scripts
โโโ package-lock.json โ exact versions
โโโ tsconfig.json โ compiler config
โโโ .gitignore โ ignored paths
โโโ README.md
Visual: Editor-Build Alignment
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ VS Code bundled TS โ
โ โ
โ Ships with VS Code โ
โ May not match project โ
โ โ "editor says OK, tsc fails" โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Workspace TS โ
โ โ
โ From node_modules/typescript โ
โ Matches what the build uses โ
โ โ editor and tsc agree โ
โ โ
โ Select via: โ
โ Command Palette โ TS: Select Version โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Summary
| Concept | Meaning |
|---|---|
| Node.js | Runtime for tooling and the compiler |
| npm | Package manager โ installs TypeScript |
| TypeScript compiler | tsc โ checks and emits JavaScript |
| Local install | Per-project, pinned in package.json |
| Global install | System-wide, for quick scripts |
tsconfig.json | Compiler configuration |
package.json | Dependencies and scripts |
package-lock.json | Exact dependency versions |
tsx | Fast runner for dev |
ts-node | Older runner |
| VS Code workspace TS | Match editor and build versions |
Key takeaways:
- Node.js LTS is the foundation โ install it first
- npm ships with Node โ no separate install
- Install TypeScript locally in every project (
--save-dev) - Use
npx tscinside projects to run the local compiler tsconfig.jsonconfigures the compiler โstrict: trueis the recommended baseline- Keep source in
src/and build output indist/โ both intsconfigand.gitignore - Commit
package.json,package-lock.json, andtsconfig.json; ignorenode_modules/anddist/ - Use
tsxfor fast dev runs,tscfor production builds,tsc --noEmitfor CI type-checks - Set VS Code to use the workspace TypeScript version so the editor and build agree
- Version managers (
nvm) help with multi-project work - Verify the setup with
node --version,npm --version,npx tsc --version
Remember: The environment is a one-time investment. Install Node LTS, add TypeScript locally to each project, configure tsconfig.json, ignore the generated folders, and make the editor match the build. After that, everything is TypeScript โ write .ts, run with tsx for dev, compile with tsc for production. The toolchain gets out of your way, and you focus on the code.
Stop using slow, ad-bloated tool sites! ๐คฎ
๐ Search “KandZ Tools” on Google to use many professional utilities for free.
KandZ.me is the ultimate minimalist hub for:
โ
Finance (Mortgage, Interest, Inflation)
โ
Tech (Base64, JSON, Dev Suite, IP)
โ
Health (BMI, BMR, TDEE)
โ
Productivity (Timer, Workspace, QR)
โก๏ธ Fast & Private
๐ No data leaves your device
๐ 100% Free
๐ Use it now: https://tools.kandz.me
๐ Bookmark itโyouโll need it later!