Your AI writes the API it remembers. TanStack 1.168.60 had already deprecated it.
Don't trust your AI on TanStack 1.168: Claude got it wrong. Not with a typo. With a deprecation.
We were upgrading @tanstack/react-start from 1.168.32 to 1.168.60 on a small site. The AI doing the edit was sure that inputValidator was the current name for a server function's validator. The installed package disagreed, right above the declaration:
/** @deprecated Use validator instead. */ inputValidator: ... Why this keeps happening
Here's the thing we keep relearning: a model knows an API from its training data. Your code runs against whatever version your lockfile installed this morning. Those two drift apart every week, and the drift is worst exactly where you need help most: right after an upgrade.
Popular libraries rename things, sometimes back and forth. If the model saw a lot of code using one name, it writes that name with full confidence, whether or not the version you just installed has moved on.
The habit that fixes it (works with any AI tool)
- Find the installed definitions. For TypeScript, that's the
.d.tsfiles innode_modules/<package>. - Look for deprecations next to the names the AI used:
grep -rn -B2 "inputValidator" node_modules/@tanstack/*/dist --include=*.d.ts | grep -i deprecated - Paste those lines into the prompt and say: these are the definitions of the version installed now; trust them over what you remember.
In our experience, that third step changes the result more than any amount of "please use the latest API". We've tried both.
The same idea works outside JavaScript: Python packages ship their source and stubs in site-packages, Go modules carry // Deprecated: comments in the module cache, and a Java or Kotlin jar keeps its @Deprecated annotations, readable with javap.
What we built from this
Since November 12, every Versyka fix does this before each edit: it reads the definitions of the functions your code calls from the version just installed, deprecation notes first, and gives them to the model with the instruction to trust them over memory. TypeScript and JavaScript, Python, Go, Java and Kotlin.
Has an AI assistant ever handed you an API that the version you'd installed had already deprecated?