When an AI assistant writes a route handler for you, it compiles. That is the easy part. The bugs that survive a quick review are the ones the compiler cannot see: values that have the right type on paper and the wrong value at runtime.
This post is for developers who already review AI-assisted diffs (or write TypeScript for APIs) and want a short list of runtime traps to check for. Each one is a script you can paste and run. Nothing here is a benchmark or a claim about how often any tool makes these mistakes. These are shapes I look for in review, and I ran every snippet below on Node 22.
1. as is not validation
A handler reads JSON and asserts the type:
type CreateItem = { name : string ; quantity : number ; unitPriceCents : number } ;
// 1. A type assertion does not check anything at runtime. const body : unknown = JSON . parse ( '{"name":"Pen","quantity":"5","unitPriceCents":250}' ) ; const item = body as CreateItem ; console . log ( "1 total:" , item . quantity * item .…