ReviewOS

home-lang/home

fix(ts): preserve contextual signatures with qualified imported types

#588
Closed chris opened this 9 days ago ·
9 days ago

Parent: #548

The pinned Zod 4.5.2 production corpus still reports 165 false TS7006 diagnostics in src/v4/core/json-schema-processors.ts. Each annotated processor is contextually typed by the imported generic alias Processor<t>, whose function parameters include namespace-qualified imported types such as schemas.$ZodType and JSONSchema.BaseSchema.

A minimal strict NodeNext project reproduces four false TS7006 diagnostics for one function expression while pinned tsc 6.0.3 and tsgo 7.0.2 are silent. The program declaration schema currently rejects every qualified type reference, discarding the surrounding callable annotation and therefore all contextual parameter types.

Acceptance criteria:

  • resolve one-segment namespace-qualified type references through their actual namespace import and exported type owner
  • preserve the exact outer function signature even when a referenced leaf type is outside the transferable schema subset, degrading only that leaf safely
  • add focused declaration-graph and program regression coverage
  • verify the reduction against pinned tsc and tsgo
  • measure the untouched 106-file Zod corpus deterministically
  • do not publish a timing or README row until the corpus is semantically admissible
9 days ago

Implemented and pushed directly to origin/main as c71870a (fix(ts): preserve contextual imported function aliases (#588)).

Validation:

  • minimal strict NodeNext reduction: Home, pinned tsc 6.0.3, and pinned tsgo 7.0.2 all exit 0 with empty output
  • untouched pinned Zod 4.5.2 corpus: 106 production TypeScript files
  • Home diagnostics: 1,322 -> 1,166
  • exact set delta: 156 removed, all TS7006; 0 added
  • two Home runs were byte-identical, SHA-256 6f30c07c30b804eeb88181108347bfd5e11083d9000467fc6157906d62365ad6
  • pinned tsc and tsgo remain silent on the corpus
  • full ts_checker and ts_program suites pass
  • zig fmt --check, scoped bunx --bun pickier, and git diff --check pass

The nine remaining TS7006 diagnostics are nested library/array callbacks and are tracked separately in #589. No timing/README row is published yet because the corpus is still not semantically admissible.

Sign in to comment on this issue.