The admitted Zod 4.5.2 baseline on a5ae69070 contains 60 identical TS7006 diagnostics across src/v4/locales/*.ts. Every locale declares an annotated factory such as:
import type * as errors from "../core/errors.js";
const error: () => errors.$ZodErrorMap = () => {
return (issue) => issue.code;
};$ZodErrorMap is an imported callable interface whose parameter is $ZodRawIssue<T>. TypeScript 6.0.3 and native TypeScript 7.0.2 contextually type issue; Home loses the callable return context and reports TS7006.
Implement the general contextual-typing fix at the source-owned Program schema / checker boundary. Preserve the callable interface's parameter and result graph when it appears as the return type of an annotated function and contextually types a returned arrow. Do not special-case Zod, infer from source text, or suppress noImplicitAny.
Required controls:
- imported callable interface used as an annotated factory return;
- qualified namespace import and direct type import forms;
- deliberate wrong callback return/body access proving the transferred type is enforced;
- local/shadowed names must not borrow foreign schema facts;
- repeated prepared-owner queries must not reparse or check the owner;
- exact same-parent Zod A/B with two deterministic ReleaseFast runs and zero additions before any timing claim.