← Brakes: coding with AI agents

Brakes: coding with AI agents · Part 2

Your agent called a method that doesn't exist

· by Tony Tang

The agent writes cart.applyCoupon(), a method the cart doesn't have, and plain JavaScript ships it: "not a function" in prod on a Friday night. In TypeScript it's a red line in five seconds, before the file is saved. Turn on strict mode and every guess the agent makes is a red line it can read and fix. Then block the as any escape hatch with the no-explicit-any lint rule. The compiler is a reviewer that never gets tired.

Comment below: Is strict mode on in your project?

Brakes: a series on the checks that let an AI coding agent go fast without shipping bugs. Every best practice shortens the time between writing a bug and finding it. Brakes are why race cars go fast. All code is real TypeScript on Node 24, typechecked and tested before it went on screen.

More from this series