This is the last day. You do not add features today. You make the app you have solid: no failing tests, no type errors, no bugs you know about, usable with only a keyboard, built for the web, and described well enough that someone else could run it. Then you look back over the 25 days and decide where to go next.
There is no new reading, and nothing new to learn. Plan for about 35 minutes of fixing and checking, 15 for the build and the README, and 10 for looking back. As before, the examples use the flashcard app; every step applies to any of the four projects.
25.1 Fix What Is Broken
Goal: npm run check reports no errors, npm test passes, and every problem on yesterday’s list is fixed or written down as a known issue.
Start from the list you made at the end of Day 24. Then add to it by running the three checks, in this order:
npm run check. Fix type errors first: while a file does not type-check, you cannot trust anything the tests or the browser tell you about it. Read each message from its file name and line number, as on Day 1.npm test. For each failing test, read its name first: it says which rule broke. Then decide which is wrong, the code or the test. A test written yesterday in a hurry can expect the wrong thing, but never change a test just to make it pass without understanding why it failed.- Use the app yourself, on purpose. Tests only check what you thought of. Spend ten minutes trying to break the app: empty boxes, very long text, text with spaces at both ends, deleting the last item, deleting during a study round, reloading at every step, and the broken save from Day 24. Keep the browser’s developer tools open on the Console tab: a red error there is a bug, even if the page looks fine.
Fix one problem at a time, and after each fix, run npm run check and npm test again. A fix that breaks something else is not a fix. When you find a bug the tests missed, write a test for it before you fix it: the test fails, you fix the code, the test passes, and the bug can never quietly return.
If a bug is too big to fix today, write it in PLAN.md under a heading Known issues. A known issue is honest; a hidden one is a trap for whoever uses the app next, which is usually you.
Key idea
Fix type errors first, then failing tests, then the bugs you find by using the app. After every fix, check and test again, and turn each bug the tests missed into a new test.
Pause and try
Question 1 · Debugging
Sam’s flashcard app crashes when a study round is on the last card and that card is deleted. Sam reduced the problem to this file. npx tsc reports no errors. Predict what node study-bug.ts prints, explain why the checker did not catch it, and fix it.
type Card = { id: number; front: string; back: string; right: number; wrong: number };
type Study = { position: number; showingAnswer: boolean };
const cards: Card[] = [
{ id: 1, front: "const", back: "A variable that cannot be reassigned", right: 0, wrong: 0 },
];
const study: Study = { position: 1, showingAnswer: false };
const card = cards[study.position];
console.log(`Card ${study.position + 1} of ${cards.length}`);
console.log(card.front);Check your reasoning
Card 2 of 1and then the program stops with:
TypeError: Cannot read properties of undefined (reading 'front')The deck has one card, at position 0, but study.position is still 1 from before the delete. cards[1] is undefined. The checker gives cards[study.position] the type Card, because indexing a Card[] always has that type; it cannot know whether the position is inside the array. So line 10 prints the impossible “Card 2 of 1,” and line 11 reads front from undefined, which is a runtime error, not a type error.
Check for undefined before using the card:
type Card = { id: number; front: string; back: string; right: number; wrong: number };
type Study = { position: number; showingAnswer: boolean };
const cards: Card[] = [
{ id: 1, front: "const", back: "A variable that cannot be reassigned", right: 0, wrong: 0 },
];
const study: Study = { position: 1, showingAnswer: false };
const card = cards[study.position];
if (card === undefined) {
console.log("That card is gone. Study mode is off.");
} else {
console.log(`Card ${study.position + 1} of ${cards.length}`);
console.log(card.front);
}That card is gone. Study mode is off.In the real app, the better fix is the one Day 24 used: deleting a card sets state.study to null, so the round ends and the position can never point past the end. renderStudy also checks for undefined, so even a missed case draws nothing instead of crashing.
Reread 25.1 Fix What Is Broken if you expected the checker to catch this.
25.2 Check It With Only a Keyboard
Goal: you can use every feature of the app without touching the mouse or trackpad.
Many people cannot use a mouse, and many others prefer the keyboard. An app that only works with a mouse shuts them out. The check is simple: put the mouse out of reach, reload the page, and use the app with Tab (next control), Shift+Tab (previous control), Enter and Space (press a button), and typing. Go through every feature on your must-have list and tick each row:
| Check | What to look for | If it fails |
|---|---|---|
| Tab reaches everything | Every input and button gets focus, in the order they appear on the page | A clickable <div> or <span> must become a <button> |
| You can see where focus is | An outline around the focused control | Remove any CSS that sets outline: none |
| Enter submits the form | Typing in a box and pressing Enter adds the item | The form’s button needs type="submit", inside the <form> |
| Buttons work with Enter and Space | Every button does the same as a click | It is not a real <button>; replace it |
| Focus is not lost after a render | After pressing a button that redraws part of the page, the next Tab goes somewhere sensible | Move focus on purpose, as focusStudy() does on Day 24 |
| Errors are announced | Error messages appear in an element with aria-live |
Add aria-live="polite" to the error list |
The fourth and fifth rows are where most apps fail. When render() replaces a list or a panel, the button that had focus is removed from the page, and the browser’s focus falls back to the top of the page. A keyboard user then has to Tab all the way back. That is why the flashcard app moves focus to the first box after adding a card, and to the next study button after each answer.
Pause and try
Question 2 · Multiple choice
A habit tracker draws each day as <div class="day"> with a click listener. It works with a mouse. What happens for a keyboard user, and what is the fix?
- Nothing goes wrong; every element on the page can be reached with Tab
- Tab skips the days and Enter does nothing to them, so they cannot be ticked; draw each day as a
<button type="button">instead - The days work, but only with Space; add a listener for Enter as well
- The checker reports an error, because a click listener needs a button
Check your reasoning
B. A <div> is not a control. Tab moves only between controls such as inputs, links and buttons, so it skips the <div>s, and Enter and Space do nothing to them. A <button> gets all of that for free: it is in the Tab order, Enter and Space fire its click event, and a screen reader announces it as a button. Its delegated listener does not need to change.
- A is wrong: Tab reaches only controls, not every element.
- C is wrong: a
<div>responds to neither key; adding key listeners still leaves it out of the Tab order. - D is wrong:
addEventListener("click", …)is allowed on any element, so the checker accepts it. That is exactly why this has to be tested by hand.
Reread 25.2 Check It With Only a Keyboard and Day 19 if you chose differently.
25.3 Make Sure Every Input Has a Label
Goal: every input in the app has a <label>.
A placeholder (the grey hint text inside an empty box) is not a label: it disappears as soon as the person types, and many screen readers do not read it. Every input needs a <label>, either with a for that matches the input’s id, or wrapped around the input (Day 20).
You can check by eye, but a page grows, and a short script checks every input at once. This one uses only what you know. Every input element has a labels property: a list of the labels attached to it, empty when there are none.
const inputs = document.querySelectorAll("input");
let missing = 0;
for (const input of inputs) {
if (input.labels === null || input.labels.length === 0) {
console.log(`No label: #${input.id}`);
missing = missing + 1;
}
}
console.log(`${inputs.length} inputs, ${missing} without a label`);It has no type annotations, so it is also plain JavaScript: you can paste it into the browser’s Console tab while your app is open, and it checks the page you are looking at. Here is a page with a search box added at the top:
<main>
<h1>Flashcards</h1>
<input id="search" placeholder="Search cards">
<form id="card-form">
<label for="front">Front</label>
<input id="front" name="front">
<label>Back <input id="back" name="back"></label>
<button type="submit">Add card</button>
</form>
</main>Pause and try
Question 3 · Tracing
Predict exactly what the script prints for this page, then fix the page so it prints that no input is missing a label.
Check your reasoning
No label: #search
3 inputs, 1 without a labelquerySelectorAll("input") finds three inputs. #front has a label through for="front". #back is inside a <label>, which also counts. #search has only a placeholder, so its labels list is empty, and missing becomes 1.
The fix is a label for the search box:
<label for="search">Search cards</label> <input id="search" placeholder="Search cards" />Reread 25.3 Make Sure Every Input Has a Label if you counted the wrapped #back as missing.
25.4 Build It and Open the Built App
Goal: npm run build succeeds, and the built app works when you open it.
So far you have used npm run dev, Vite’s development server, which turns your TypeScript into JavaScript one file at a time as the browser asks for it. A real website serves a build: the whole app turned into plain HTML, CSS and JavaScript files, ready to copy to any web host. Make one:
npm run build
The template’s build script is tsc && vite build: tsc checks every file in src/ first, and && runs vite build only if the check passed. So a type error in any file, even a test file, stops the build. When it succeeds, the built app is in a new folder, dist/. Look inside: index.html, an assets/ folder with your code combined into one JavaScript file, and everything from public/, including starter.json. dist/ is made from your source, so you never edit it by hand; rebuild instead. Vite’s template already lists it in .gitignore.
To open the built app, let Vite serve the dist/ folder:
npm run preview
Open the address it prints and run through your must-have list one last time. The built app should behave exactly like the development version. If something works in npm run dev but not here, the usual cause is a file path: a file the code fetches must be in public/, and its path must start with /, as /starter.json does.
Key idea
npm run build type-checks everything, then writes the finished app to dist/. npm run preview serves that build,
so you test what a visitor would actually get.
25.5 Write the README
Goal: a README.md in the project folder that says what the app does, how to install it, and how to run it.
A README is the first file anyone opens in a project. Hosting sites such as GitHub show it on the project’s front page. It answers three questions for someone who has never seen your app: What is it? How do I get it running? How do I check it works? Write it for a classmate who knows what Node is, but nothing about your app. Here is the flashcard app’s README:
# Flashcards
A small study app. Add question-and-answer cards, then study them one at a
time: reveal each answer and mark whether you got it right. The app keeps a
running score and saves the deck in your browser. The first time it opens,
it loads a starter deck.
Built with TypeScript and Vite. No server, no account: everything stays in
your browser's localStorage.
## Install
You need Node 24 or newer.
npm install
## Run
npm run dev
Then open the address it prints.
## Check and test
npm run check
npm test
## Build
npm run build
npm run preview
## Known issues
- Only one deck. Several decks is on the nice-to-have list.
Lines indented by four spaces are shown as code. Keep the README short; a long one does not get read. Then follow it yourself, one command at a time, in a new terminal. Better still, ask someone else to follow it: every place they get stuck is a missing line.
Pause and try
Question 4 · Short answer
Write the README for your own app, with at least the four parts above: a description, how to install, how to run, and how to test. Then name one thing a reader would need to know about your app that the flashcard README does not cover.
Check your reasoning
A complete answer has:
- A first paragraph a stranger understands: what the app is for, what a person can do with it, and that the data stays in the browser.
- Install: the Node version and
npm install. - Run:
npm run dev, and that they should open the address it prints. - Check and test:
npm run checkandnpm test. - Build, if you want to describe it, and any Known issues.
What your app needs on top depends on the project. A habit tracker should say how a “day” is decided and that ticking a past day is allowed or not. A budget tracker should say which currency and categories it assumes. A recipe box should say how scaling rounds the amounts. Any app with a starter file in public/ should say where it is, so a reader can replace it with their own.
Reread 25.5 Write the README and check your README against its three questions.
25.6 Look Back
Goal: see how far you have come, in your own files.
Open the day01 folder and read hello.ts, the program from Day 1. Two lines that printed a greeting. Then open your capstone’s main.ts. In 25 days you went from console.log to an app with typed data, modules, validation, saved data, tests and a build: the same steps professional TypeScript developers take every day, at a smaller size.
Then read your recap notes from each day, especially the lines where you wrote which day felt shaky. Is it still shaky? If you used it in the capstone, it probably is not. If you avoided it, that is a good candidate for what to learn next.
25.7 Three Things to Learn Next
Goal: three next steps, written down, each specific enough to start tomorrow.
Here are the main directions from here. Each builds directly on this course:
| Direction | What it is | A first step |
|---|---|---|
| Front-end frameworks | React, Svelte or Vue: tools that do the “change the state, then render” loop for you, for much bigger pages. All support TypeScript | Rebuild your capstone’s list with one of them, using its Vite template |
| Back end | Node with a framework such as Fastify or Hono, and a database, so data is shared between people and devices | A small server that saves your capstone’s items instead of localStorage |
| Deeper TypeScript | Mapped and conditional types: types built from other types | The Handbook’s “Type Manipulation” section, then the type-challenges exercises |
| Tooling | ESLint (finds suspicious code), Prettier (formats it), and GitHub Actions (runs your checks on every change) | Add ESLint and Prettier to your capstone and fix what they report |
| Practice | Many small problems, each solved properly | Exercism’s TypeScript track, or Advent of Code puzzles in December |
Write three next steps in PLAN.md under Next. Make each one specific: not “learn React,” but “rebuild the flashcard list in React.” Pick at least one that uses your capstone: you know that code better than any tutorial’s, so changes to it teach you the most.
Key idea
The best next project is usually the one you just finished. Add a nice-to-have, fix a known issue, or rebuild it with a new tool, and you will learn the new thing on code you already understand.
Final self-check
Your capstone is finished when every row matches.
| Try | Should happen |
|---|---|
npm run check |
No errors |
npm test |
At least five tests, all passing |
| Use every must-have with only a keyboard | Everything works, and you can always see where focus is |
| Run the label script in the Console | No input without a label |
| Ten minutes trying to break the app | No red errors in the Console; known issues are written down |
npm run build, then npm run preview |
The built app works like the development one |
Follow README.md in a new terminal |
Every command works as written |
Open PLAN.md |
Must-haves done, known issues, and three next steps |
- npm run check and npm test are clean. Reread
- Every feature works with only a keyboard. Reread
- Every input has a label. Reread
- The app builds and the built version works. Reread
- README.md says what the app does and how to install, run and test it. Reread
- PLAN.md lists three specific things to learn next. Reread
Go further
Day 25 has no new reading. For the keyboard and label checks, MDN: Accessibility is a good next stop, and the Vite Guide: Building for Production explains what npm run build does in more detail.
Reflection
Check each statement. If the answer is “not yet,” reread the linked section. Then write a last line in your notes: what are you proudest of in your capstone?
- I can find and fix bugs in order: type errors, then failing tests, then bugs found by using the app. Reread
- I can explain why the checker cannot catch an index past the end of an array. Reread
- I can check an app with only a keyboard and fix what fails. Reread
- I can make sure every input has a label. Reread
- I can build a Vite app and test the built version. Reread
- I can write a README that lets someone else run my project. Reread
- I can name three specific things to learn next. Reread