Ch 6 · The Project You Set Up On Every Job · TypeScript

Topic 6 of 6 in TypeScript — Types That Protect Paid Work — 5 lessons.

Three Files and a Build

Everything so far ran as a single snippet. Real work is a project on disk: a package.json that records exactly which tools the project needs, a tsconfig.json that tells the compiler how strictly to check and where to put its output, and your source under src/. Read all four files together — this is the complete thing, not an extract.

What Each tsconfig Line Buys You

Most people copy a tsconfig.json from a template and never read it, which means they cannot fix it when it fights them. Here is what each line in the project above is actually doing.

The Four Commands

Four commands run this project from empty folder to output. Type them in a terminal, in this order, in the project folder.

Reading the Compiler's Complaints

TypeScript's error messages are more precise than most tools you have used, and they are worth learning to read rather than pasting straight into a search box. Four cover most of your first month.

What to Show a Client

You will not be asked "do you know TypeScript" in those words. What you will be asked, in effect, is whether your code can be handed to someone else. Types are the cheapest way to answer yes.

All topics in TypeScript Beginner

  1. Why TypeScript Is Worth Your Time
  2. The Types You Will Use Every Day
  3. Describing Your Data Once
  4. Functions That State Their Terms
  5. The Holes in the Fence
  6. The Project You Set Up On Every Job