requiredDefined
requiredDefined<
T>(path,option?):void
Defined in: projects/ngx-signal-schema/src/lib/validators/required-defined.ts:26
Validator that ensures a value is defined (not null or undefined).
Important: Use this validator primarily for non-string types where false, 0, or empty arrays
are valid and intentional selections. For string/text inputs, use requiredTrimmed instead.
This is particularly useful for boolean fields (checkboxes, toggles) where the standard required
validator might treat false as a missing value (falsy). This validator explicitly checks that
a value is present, regardless of whether it is true or false.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”SchemaPath<T>
The schema path to the field to validate.
option?
Section titled “option?”Optional configuration for the validator.
Returns
Section titled “Returns”void
Example
Section titled “Example”// Correct use for mandatory booleanrequiredDefined(path.agreedToTerms);requiredTrimmed - Use this for string/text fields.