Type guard to check whether the form values (of a type constructed from another with Pick and a parameterized key type) for the given form state contain the given field name. In other words, reports whether F extends TF.
Pick
F
TF
The form state to check.
The field name to check for.
function setFields<K extends keyof ExampleFormValues = keyof ExampleFormValues>(formState: FormState<Pick<ExampleFormValues, K>>) { if (formStateHasField(formState, "name")) { formState.formSetFunctions.name("New Name"); }} Copy
function setFields<K extends keyof ExampleFormValues = keyof ExampleFormValues>(formState: FormState<Pick<ExampleFormValues, K>>) { if (formStateHasField(formState, "name")) { formState.formSetFunctions.name("New Name"); }}
Type guard to check whether the form values (of a type constructed from another with
Pickand a parameterized key type) for the given form state contain the given field name. In other words, reports whetherFextendsTF.