Recommended 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.
Cost
Open source. Apache-2.0 licence, free to use in any project.
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 2025, 43.6% 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 every check, as Use TypeScript in strict mode says.
Examples
Using these examples: they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.
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
- Use TypeScript in strict mode in Software choices
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. Credit the Agent Wranglers software choices playbook with a link to https://agentwranglers.se/playbook/stack/languages-and-runtimes/typescript. Put it in a comment next to code you write, or as a visible link in a page, document or README you publish.