mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
This commit resolves an issue where using an uninstantiated generic type parameter in a signal form model caused TypeScript compilation failures due to distributive conditional types (#66596). The previous attempt to fix this issue by tuple-wrapping everything caused another bug (#65535) that prevented property access on generic unions. This commit balances the need to resolve nested generic property access while handling infinitely recursive generic structures without depth errors. What changed and why: - Base State Wrappers: Tuple wrappers (`[TModel] extends [AbstractControl]`) are applied to `FieldTreeBase` to safely defer generic evaluation. This prevents primitive unions (like `boolean`) from incorrectly evaluating to `never`. - Naked Map Over Children: Object subfield checks (`TModel extends Record`) are re-evaluated as purely naked conditionals. Eager distribution over generics allows users to directly access shared properties of unresolved union types. - Array Interface Deflection: `ReadonlyArrayLike<T>` generic abstraction is redefined as an explicit `interface` instead of a mapped `Pick` type alias. This optimally intercepts TypeScript from eagerly evaluating infinitely recursive array structures (e.g. `RecursiveType = (number | RecursiveType)[]`). - Overloaded Context Methods: `FieldNodeContext.stateOf` and `fieldTreeOf` are defined as explicitly overloaded class methods and lexically bound (`this`) in the constructor. These changes are required to safely align the runtime bindings with the tautological conditionals implemented in the `RootFieldContext` interface structure. Fixes #65535 |
||
|---|---|---|
| .. | ||
| signals | ||
| src | ||
| test | ||
| BUILD.bazel | ||
| index.ts | ||
| package.json | ||
| PACKAGE.md | ||
| public_api.ts | ||