Parent: #548
Problem
After #666–#670, an imported mapped/conditional/Extract handler graph is exact across three modules while every discriminated member is wholly transferable. Adding one unrelated unsupported sibling to the same object erases the entire contextual member path:
export interface A {
_zod: { def: { type: "a" }; opaque: Set<string> };
a: number;
}
export interface B {
_zod: { def: { type: "b" }; opaque: Set<string> };
b: string;
}Nothing in the handler reads opaque. TypeScript 6.0.3 and the native preview still infer handler property a as (item: A, rewritten: boolean). ReleaseFast Home changes from the exact 2× TS2322 + 2× TS2339 control multiset to two false TS7006 diagnostics and misses the callback controls.
The Program schema already has contextual-only projection semantics that may preserve exact outer callable/object structure while degrading an unsupported leaf to any. The current projection lowers an entire member to any when any nested declaration/unsupported leaf is present, so the supported _zod.def.type chain disappears with its sibling.
This minimal differential mirrors the remaining Zod 4.5.2 core/visit.ts boundary: schema interfaces expose exact nested discriminants and handler-relevant members alongside large unrelated graphs.
Fair strict oracle
- Same three modules, root order,
NodeNext,strict, andnoEmitfor TypeScript 6.0.3, native TypeScript, and ReleaseFast Home. - The only change from the passing #670 oracle is one unused opaque sibling with a standard generic type.
- Valid keys, invalid key, wrong assignment, missing discriminated member, and missing boolean member remain independent controls.
- An additional negative control attempts to consume the projected handler alias as a general imported type; it must not publish the leaf-degraded approximation outside contextual callable input.
Acceptance
- Preserve exact supported object/function/mapped/conditional/indexed/
Extractscaffolding inside contextual callable input while degrading only the unsupported leaf. - Keep source declaration and type-parameter identities and allow
Extractto discriminate on the retained nested literal path. - Do not expose a contextual projection through ordinary imported annotations, assertions, variables, returns, or structural relations.
- Do not fabricate members, flatten namespaces, broaden key domains, or treat a failed projection as a supported whole declaration.
- Keep recursive graphs finite by declaration identity and retain existing class/function/nominal safety guards.
- Add permanent schema and Program positive/negative regressions and match the exact TypeScript 6.0.3/native focused oracle with no TS7006/TS2345.
- Run complete Program/checker suites, ReleaseFast, formatting, whitespace, and required Pickier.
- Run the unchanged pinned Zod 4.5.2 graph twice, require zero additions, and document exact removals or unchanged results.
- Publish the detailed audit and linked README table.
No Zod/package/path/name/property/line special cases, source-text matching, whole-object any, callback-value-driven overload selection, or benchmark-only member synthesis.