File tree Expand file tree Collapse file tree
goldens/public-api/forms/signals
packages/forms/signals/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -431,6 +431,12 @@ export type NgValidationError = RequiredValidationError | MinValidationError | M
431431// @public
432432export type OneOrMany <T > = T | readonly T [];
433433
434+ // @public
435+ export interface ParseResult <TValue > {
436+ readonly errors? : readonly ValidationError .WithoutFieldTree [];
437+ readonly value? : TValue ;
438+ }
439+
434440// @public
435441export type PathKind = PathKind .Root | PathKind .Child | PathKind .Item ;
436442
Original file line number Diff line number Diff line change @@ -14,9 +14,23 @@ import {
1414 type WritableSignal ,
1515} from '@angular/core' ;
1616import { FORM_FIELD_PARSE_ERRORS } from '../directive/parse_errors' ;
17- import { createParser , type ParseResult } from '../util/parser' ;
17+ import { createParser } from '../util/parser' ;
1818import type { ValidationError } from './rules' ;
1919
20+ /**
21+ * Result of parsing a raw value into a model value.
22+ */
23+ export interface ParseResult < TValue > {
24+ /**
25+ * The parsed value, if parsing was successful.
26+ */
27+ readonly value ?: TValue ;
28+ /**
29+ * Errors encountered during parsing, if any.
30+ */
31+ readonly errors ?: readonly ValidationError . WithoutFieldTree [ ] ;
32+ }
33+
2034/**
2135 * Options for `transformedValue`.
2236 *
Original file line number Diff line number Diff line change 88
99import { type Renderer2 , untracked } from '@angular/core' ;
1010import { NativeInputParseError , WithoutFieldTree } from '../api/rules' ;
11+ import type { ParseResult } from '../api/transformed_value' ;
1112
1213/**
1314 * Supported native control element types.
@@ -49,11 +50,6 @@ export function isTextualFormElement(element: HTMLElement): boolean {
4950 return element . tagName === 'INPUT' || element . tagName === 'TEXTAREA' ;
5051}
5152
52- export interface NativeControlValue {
53- value ?: unknown ;
54- errors ?: readonly WithoutFieldTree < NativeInputParseError > [ ] ;
55- }
56-
5753/**
5854 * Returns the value from a native control element.
5955 *
@@ -69,7 +65,7 @@ export interface NativeControlValue {
6965export function getNativeControlValue (
7066 element : NativeFormControl ,
7167 currentValue : ( ) => unknown ,
72- ) : NativeControlValue {
68+ ) : ParseResult < unknown > {
7369 let modelValue : unknown ;
7470
7571 if ( element . validity . badInput ) {
Original file line number Diff line number Diff line change 88
99import { type Signal , linkedSignal } from '@angular/core' ;
1010import type { ValidationError } from '../api/rules' ;
11-
12- /**
13- * Result of parsing a raw value into a model value.
14- */
15- export interface ParseResult < TValue > {
16- /**
17- * The parsed value, if parsing was successful.
18- */
19- value ?: TValue ;
20- /**
21- * Errors encountered during parsing, if any.
22- */
23- errors ?: readonly ValidationError . WithoutFieldTree [ ] ;
24- }
11+ import type { ParseResult } from '../api/transformed_value' ;
2512
2613/**
2714 * An object that handles parsing raw UI values into model values.
You can’t perform that action at this time.
0 commit comments