Skip to content

Commit 6889f1e

Browse files
committed
refactor(forms): move CompatFieldState to be an interface
This is slightly more clear than using a declared `type`, and nicer for documentation. Functionally it should not behave any differently.
1 parent df7121b commit 6889f1e

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

goldens/public-api/forms/signals/index.api.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,10 @@ export interface ChildFieldContext<TValue> extends RootFieldContext<TValue> {
6565
}
6666

6767
// @public
68-
export type CompatFieldState<TControl extends AbstractControl, TKey extends string | number = string | number> = FieldState<TControl extends AbstractControl<unknown, infer TValue> ? TValue : never, TKey> & {
68+
export interface CompatFieldState<TControl extends AbstractControl, TKey extends string | number = string | number> extends FieldState<TControl extends AbstractControl<unknown, infer TValue> ? TValue : never, TKey> {
69+
// (undocumented)
6970
control: Signal<TControl>;
70-
};
71+
}
7172

7273
// @public
7374
export type CompatSchemaPath<TControl extends AbstractControl, TPathKind extends PathKind = PathKind.Root> = SchemaPath<TControl extends AbstractControl<unknown, infer TValue> ? TValue : never, SchemaPathRules.Unsupported, TPathKind> & {

packages/forms/signals/src/api/types.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,15 @@ export interface FieldState<TValue, TKey extends string | number = string | numb
319319
* @category interop
320320
* @experimental 21.0.0
321321
*/
322-
export type CompatFieldState<
322+
export interface CompatFieldState<
323323
TControl extends AbstractControl,
324324
TKey extends string | number = string | number,
325-
> = FieldState<TControl extends AbstractControl<unknown, infer TValue> ? TValue : never, TKey> & {
325+
> extends FieldState<
326+
TControl extends AbstractControl<unknown, infer TValue> ? TValue : never,
327+
TKey
328+
> {
326329
control: Signal<TControl>;
327-
};
330+
}
328331

329332
/**
330333
* Allows declaring whether the Rules are supported for a given path.

0 commit comments

Comments
 (0)