Parent: #548
Problem
After #666–#668, imported overloads, mapped-key identity, conditional handlers, nested structural Extract, and standard Extract<T, U> all transfer losslessly. An equivalent handler still collapses to implicit any when its mapped key domain is named through a source-owned indexed-access alias:
export interface A { kind: "a"; a: number }
export interface B { kind: "b"; b: string }
export type Item = A | B;
export type Kind = Item["kind"];
export type ItemOfKind<K extends Kind> = Extract<Item, { kind: K }>;
export type Handlers = { [K in Kind]?: (item: ItemOfKind<K>, rewritten: boolean) => Item };The same reduction passes when Kind is spelled directly as "a" | "b". A nested _zod.def.type discriminant also passes with that literal domain. This isolates source-owned indexed-access alias resolution, not nested structural conditional matching.
Fair strict oracle
An imported overloaded visit(item, handler) / visit(item, handlers) call supplies property a. TypeScript 6.0.3 and the native preview infer callback item A and boolean, reporting only deliberate TS2322 plus two TS2339 controls. ReleaseFast Home emits two false TS7006 diagnostics and misses the controls.
This mirrors Zod 4.5.2's type Kind = schemas.$ZodTypeDef["type"] boundary without using its names or source layout.
Acceptance
- Resolve a source-owned indexed access over a transferable object/union alias to its exact property domain before mapped-property admission and specialization.
- Preserve literal union members, alias/type-parameter identity, optional mapped members, and #667 overload ambiguity rules.
- Do not widen failed indexed accesses to
string,any, or fabricated keys. - Add negative controls for a missing indexed property, an invalid object-literal property, unions with partial property coverage, nested discriminants, and generic/conditional handler use.
- Add permanent schema/Program regressions and match the exact TypeScript 6.0.3/native oracle.
- Run full Program/checker suites, ReleaseFast, formatting, whitespace, and required Pickier.
- Run the unchanged Zod 4.5.2 admission graph twice, require zero diagnostic additions, and document exact removals or unchanged output.
- Publish detailed docs plus the linked README benchmark table.
No Zod/package/path/name/property/line special cases, source-text matching, broad index widening, or callback-value-driven overload selection.