Skip to content

Commit fe7b26e

Browse files
sonukapoorthePunderWoman
authored andcommitted
docs(forms): transformedValue parse error wiring
(cherry picked from commit 547ed65)
1 parent 70e4c7f commit fe7b26e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import type {OneOrMany} from './types';
2323
*/
2424
export interface ParseResult<TValue> {
2525
/**
26-
* The parsed value, if parsing was successful.
26+
* The parsed value. If omitted, the model is not updated.
2727
*/
2828
readonly value?: TValue;
2929
/**
@@ -75,6 +75,14 @@ export interface TransformedValueSignal<TRaw> extends WritableSignal<TRaw> {
7575
* representation into an underlying model value. For example, a numeric input that displays and
7676
* accepts string values but stores a number.
7777
*
78+
* Parse errors are exposed via the returned signal’s `parseErrors()` property.
79+
* When `transformedValue` is used within a Signal Forms field context, parse errors are also
80+
* reported to the nearest field automatically. When no field context is present, no automatic
81+
* reporting occurs and `parseErrors` can be consumed directly.
82+
*
83+
* Note: `parse` may return both a `value` and an `error`. Returning `value` updates the model;
84+
* omitting it leaves the model unchanged.
85+
*
7886
* @param value The model signal to synchronize with.
7987
* @param options Configuration including `parse` and `format` functions.
8088
* @returns A `TransformedValueSignal` representing the raw value with parse error tracking.

0 commit comments

Comments
 (0)