ngrx-forms
Version:
Proper integration of forms in Angular 4 applications using ngrx
30 lines (29 loc) • 1.03 kB
TypeScript
import { Boxed, ValidationErrors } from 'ngrx-forms';
/**
* A validation function that requires the value to be `false`. Considers `null` and
* `undefined` as valid. Combine this function with the `required` validation
* function if `null` or `undefined` should be considered invalid.
*
* The validation error returned by this validation function has the following shape:
*
```typescript
{
required: {
actual: boolean;
};
}
```
*
* Usually you would use this validation function in conjunction with the `validate`
* update function to perform synchronous validation in your reducer:
*
```typescript
updateGroup<MyFormValue>({
disagreeWithTermsOfService: validate(requiredFalse),
})
```
*
* Note that this function is generic to allow the compiler to properly infer the type
* of the `validate` function for both optional and non-optional controls.
*/
export declare function requiredFalse<T extends boolean | Boxed<boolean> | null | undefined>(value: T): ValidationErrors;