Form Utilities (FormData, Sanitize, MergeForms)
HardCreate a set of utility types for working with forms in React applications.
- FormData<T> — makes all fields optional and adds isDirty
- Sanitize<T, K> — removes specified keys and makes rest readonly
- MergeForms<A, B> — merges forms: A required, B optional, common fields intersection
TypeScript•UTF-8
Run your code to see results.
Click the Run button above
Form Utilities (FormData, Sanitize, MergeForms)
HardCreate a set of utility types for working with forms in React applications.
- FormData<T> — makes all fields optional and adds isDirty
- Sanitize<T, K> — removes specified keys and makes rest readonly
- MergeForms<A, B> — merges forms: A required, B optional, common fields intersection
Examples:
Input 1: type Form = FormData<{ name: string }>
Output 1: { name?: string; isDirty: boolean }
Output
Run your code to see results.