The tsc Command-Line Interface
What you'll learn: How to use the tsc command to compile TypeScript files from your terminal.
Your Gateway to Compilation
Now that you've installed TypeScript, it's time to meet tsc — the TypeScript compiler's command-line interface. Think of tsc as the "translator" that lives in your terminal, ready to convert your TypeScript code into JavaScript that browsers and Node.js can actually run.
What Is tsc?
The tsc command is your primary tool for working with TypeScript from the command line. When you installed TypeScript (whether globally or locally in your project), you gained access to this executable. It's the entry point that triggers the entire compilation process.
The simplest use is straightforward: you point tsc at a TypeScript file, and it produces JavaScript.
How It Works
When you type tsc in your terminal, you're invoking the TypeScript compiler. You can use it to:
- Compile a single file
- Compile multiple files at once
- Watch files for changes and recompile automatically
- Check your code for type errors without producing output files
The command reads your TypeScript code, performs type-checking to catch errors, and (if successful) outputs JavaScript files that can run anywhere JavaScript runs.
Why This Matters
The tsc command is your control center. Every TypeScript workflow — whether in a small script or a massive application — ultimately relies on this compiler. Understanding that tsc is just a terminal command you can run helps demystify the entire TypeScript toolchain.
Key Takeaway: The tsc command is TypeScript's compiler interface in your terminal — it's the tool that transforms your TypeScript code into runnable JavaScript.