Skip to content

Repository files navigation

TypeScript Crash Course

A complete TypeScript learning journey from basic to advanced. Organized by topic folders with notes, examples, and inline comments.


🛠️ tsrun — Custom TypeScript CLI

This project includes a custom CLI tool called tsrun that replaces ts-node.

It compiles, runs, and cleans TypeScript files automatically with colored terminal output.

How It Works

yourfile.ts  →  temp tsconfig  →  tsc compile  →  node runs output  →  cleanup

Installation (first time only)

npm install
npm link

Usage

tsrun <file> [options]

Examples

# Run a file (no extension needed)
tsrun 00-setup/what-is-typescript

# Run with .ts extension
tsrun 00-setup/what-is-typescript.ts

# Keep the compiled .js file after running
tsrun 00-setup/compiling --keep

# Show full TypeScript compiler output
tsrun 00-setup/compiling --verbose

# Watch mode — recompile on every save
tsrun 00-setup/compiling --watch

# Show help
tsrun

Options

Option Description
--keep Keep the compiled .js file after running
--verbose Show full TypeScript compiler output
--watch Watch the file and recompile on every save

How tsrun Solves the tsconfig Conflict

Running tsc file.ts with individual flags causes a TS5112 error when a tsconfig.json already exists in the project root.

tsrun solves this by:

  1. Creating a temporary tsconfig scoped to the single file
  2. Compiling using tsc --project <temp-config>
  3. Deleting the temp config automatically after compilation
  4. Cleaning the compiled .js output after running

No conflicts. No leftover files.

Output Example

──────────────────────────────────────────────────

⚡  tsrun — TypeScript Runner

   File    : 00-setup\compiling.ts
   Version : Version 6.0.3
   OutDir  : ./dist

──────────────────────────────────────────────────

🔧  Compiling...
   ✔  Done in 921ms

──────────────────────────────────────────────────
🚀  Running: compiling.ts

──────────────────────────────────────────────────

=== Product Details ===
ID: 1
Name: MacBook Pro
Price: $2499
In Stock: Yes

──────────────────────────────────────────────────

✅  Finished in 87ms

🧹  Cleaned: compiling.js

⚙️ Commands

# Compile and run a single file
tsrun <file>

# Compile all TypeScript files
npx tsc

# Watch mode — auto compile on save
npx tsc --watch

# Check TypeScript version
npx tsc --version

🔧 Tech Stack

Tool Purpose
TypeScript Main language
Node.js Runtime
tsrun Custom compile + run + clean CLI

🤝 Contributions

Contributions are welcome. You can:

  • Improve existing examples
  • Add new practice programs
  • Fix issues or optimize code

📜 License

This project is open-source and intended for educational purposes.


⭐ Support

If you find this helpful, consider starring the repository ⭐

Author

Manjit Kumar

Portfolio
GitHub
Instagram
LinkedIn

About

TypeScript crash course from basic to advanced — organized by topic folders with notes, examples, and a custom tsrun CLI

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages