Parent
Evidence
#688 made <T extends schemas.Schema> resolve for every declaration form that owns type parameters (71c4a1a). The same interface still widens when it is written as a direct annotation instead of a constraint. On the #688 four-module oracle modules (util, errors, schemas), with the consumer changed only in how the receiver is typed:
| Consumer receiver | TypeScript 6.0.3 | Native TypeScript 7.0.2 | Home 71c4a1aed (ReleaseSafe) |
|---|---|---|---|
f<T extends schemas.Schema>(schema: T), if (!(r instanceof Promise)) { ... } | 1× TS2322 | 1× TS2322 | 1× TS2322 |
f(schema: schemas.Schema), if (r instanceof Promise) throw ... | 1× TS2322 | 1× TS2322 | 1× TS7006 |
f(schema: schemas.Schema), if (!(r instanceof Promise)) { ... } | 1× TS2322 | 1× TS2322 | 1× TS7006 |
declare const bare: schemas.Schema, read inside a function, throw guard | 1× TS2322 | 1× TS2322 | 1× TS7006 |
declare const holder: Holder<schemas.Schema> with Holder<T extends schemas.Schema> { schema: T } | 1× TS2322 | 1× TS2322 | 1× TS7006 |
Each body is const r = <receiver>._zod.run({ value, issues: [] }), followed by r.issues.map((issue) => { const wrong: number = issue; return issue.code; }), so the single TS2322 is the deliberate control. The negated guard works through a constraint, which rules out the guard form. The gap is the annotation position: Schema is a projection_only Program export, and the path #688 added for constraints (typeParameterConstraintType → programContextualExportedDeclarationType) is not reached from annotations or explicit type arguments. main at 65f80a525 reports TS7006 on all five rows. (cfdec2ea3 only changes a comment.)
Fair oracle
Reuse the #688 module fixtures (issue_688_util, issue_688_errors, issue_688_schemas in packages/ts_program/src/ts_program.zig). Cover a parameter annotation, a declared const, an explicit type argument, and a class field annotation. Each must keep the deliberate wrong: number control.
Acceptance
- TypeScript 6.0.3, tsgo 7.0.2, and Home agree on the multisets above by file, line, column, and code.
- The fix is general to annotations and type arguments naming Program-imported types. No declaration-name special case, and the #688 contextual read projection is never promoted to a value type (#688 rejected that for twelve Zod TS2345 additions).
- An exact Zod 4.5.2 core diagnostic identity A/B shows zero additions.
- Full Program/checker suites and optimized builds pass, with evidence documented and linked from the README.