Parent
Problem
A recursive, fully defaulted generic interface can retain a declaration-owned type parameter at the fixed-point edge of its lowered object graph. containsFreeTypeParameter then classifies the entire target constraint as unresolved and defers otherwise decidable invalid type arguments.
Reduced example:
interface BaseState {
output: unknown;
tag: string;
constr: new (def: any) => Type;
parent?: Type;
}
interface State<O = unknown> extends BaseState { output: O }
interface Type<O = unknown, S extends State<O> = State<O>> { _zod: S }
type SomeType = { _zod: BaseState };
type FunctionOut = Type;
interface Tuple<Rest extends SomeType | null> { rest: Rest }
interface Good<Rest extends FunctionOut = FunctionOut> { value: Tuple<Rest> }
interface Bad { value: Tuple<{ nope: number }> }
interface WrongShape { _zod: { nope: number } }
interface BadNested<R extends WrongShape> { value: Tuple<R> }Current Home ReleaseFast emits no diagnostics. TypeScript 6.0.3 accepts Good and emits TS2344 at both Bad and BadNested. TypeScript 7.0.2 accepts Good, emits TS2741 at Bad, and emits TS2344 at BadNested.
This is distinct from #633: declaration-order substitution works when the stored default remains symbolic. It is also distinct from #634's indexed-access preservation. The remaining problem is representing or classifying the closed recursive fixed point without treating its declaration-owned parameter as a genuinely free use-site argument.
Acceptance criteria
- Preserve acceptance of the valid
Gooddeclaration. - Reject both invalid locations above, matching the current TypeScript 6/7 diagnostic families and locations.
- Model the recursive default as closed, or otherwise distinguish declaration-owned fixed-point parameters from genuinely free outer parameters.
- Do not globally disable free-parameter deferral or re-lower declarations during diagnostic proof.
- Add focused checker and Program coverage with valid, concrete-invalid, and constrained-invalid controls.
- Run Debug, ReleaseSafe, and ReleaseFast checker suites.
- Re-run the unchanged pinned Zod 4.5.2 graph and require zero added normalized diagnostics.
- Document accepted results and link commits/issues.