import { FieldValues, Path, PathValue } from 'react-hook-form' // Get keys of object whose values are of a given type. export type KeysMatching = { [K in keyof T]-?: T[K] extends V ? K : never }[keyof T] // Return the field name paths that have type boolean. export type BooleanFieldNames = { [Property in Path]: PathValue extends boolean | undefined ? Property : never }[Path] // Get the keys that are functions. export type FunctionKeyOf = { [K in keyof T]: T[K] extends (...args: any[]) => any ? K : never }[keyof T]