STK-9Default Open source
Use TypeScript for web apps and APIs
Write browser code and server code in TypeScript with strict mode on, so one language and one set of types covers the whole app.
Review by
2027-01-08
How to do it
TypeScript passes all five tests. Version 1.0 shipped in April 2014, and 7.0 shipped on 8 July 2026. The npm package had 184 million downloads in the week to 18 October 2026. In the Stack Overflow Developer Survey 2026, 43.8% of developers used it. It is Apache-2.0 licensed. Types let the compiler catch the mistakes an agent makes before a visitor sees them. Version 7.0 is a rewrite of the compiler in Go, so pin 6.0 until 7.0 has been out six months, on 8 January 2027. Choose something else when the team only knows Python, or the app is mostly data work, as the Python rule below says. Turn on strict and run tsc --noEmit in the build, so nothing is typed as any.
Examples
JSON example
{
"compilerOptions": {
"strict": true,
"target": "ES2022",
"module": "NodeNext",
"noEmit": true
}
}
TypeScript example
type Booking = { id: string; startsAt: Date; seats: number };
export function totalSeats(bookings: Booking[]): number {
return bookings.reduce((sum, booking) => sum + booking.seats, 0);
}
Shell example
npm install --save-dev typescript@6.0
npx tsc --noEmit
How to check
npx tsc --version prints 6.0 or 7.0. tsconfig.json sets "strict": true. npx tsc --noEmit exits with code 0 in continuous integration.
Sources
Related rules
- ARC-51 Typing values as mixed or any in Clean code and architecture
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/stack/languages-and-runtimes/typescript">Agent Wranglers software choices playbook</a>. In code you write, add a comment next to it with the same link.