Skip to content
Free workshop ยท 10 chapters ยท about 2.5 hours

Types that catch bugs before your users do.

Learn TypeScript by building Streak, a small habit tracker you run from your terminal. Real code, short chapters, and a test suite that has your back.

example.tsโœ• 1 error
function greet(name: string) {
  return `Hi, ${name}!`
}

greet(42)

Argument of type 'number' is not assignable to parameter of type 'string'.

Psst. TypeScript spotted this before you pressed run.

Meet Streak.

Add a habit, check in each day, keep the streak alive. Small enough to build in an afternoon, real enough to use tomorrow morning: it saves to a file, refuses bad input with a clear message, and is covered by tests.

terminal
$ npm run streak -- add Read --emoji ๐Ÿ“š
Added ๐Ÿ“š Read (id: read)
$ npm run streak -- check read
๐Ÿ“š Read (daily): 1 day in a row
$ npm run streak -- check read
You already checked in on 2026-10-17.
$ npm run streak -- list
read           ๐Ÿ“š Read (daily): 1 day in a row

What you will learn.

  • 1Types you already useStrings, numbers, arrays, objects. Let inference do most of the work.
  • 2Unions and narrowingModel "this or that" exactly, and let the checker follow your if statements.
  • 3GenericsWrite a helper once and keep the types of whatever passes through it.
  • 4Safe outside dataJSON arrives as unknown. Type guards turn it into data you can trust.
  • 5Errors as valuesA Result type makes failure part of the signature, so nobody forgets it.
  • 6Tests and a real CLIVitest for behaviour, tsc for types, and a build you can run with node.

10 short chapters.

See them all
  1. 01Why TypeScript10 minutes
  2. 02Set up and run it10 minutes
  3. 03Everyday types15 minutes
  4. 04Objects, interfaces and readonly15 minutes
  5. 05Unions and narrowing20 minutes
  6. 06Functions and generics15 minutes
  7. 07Trust nothing from outside20 minutes
  8. 08Errors as values15 minutes
  9. 09Test it with Vitest20 minutes
  10. 10Ship it15 minutes

Running in a minute.

You need Node.js 22 and git. Clone, install, and watch the tests go green. Chapter 02 has the full setup.

bash
git clone https://github.com/jars-demo/typescript-demo.git
cd typescript-demo
npm ci
npm test