Skip to content

API Reference / @gtkx/forms / FieldPathByValue

Type Alias: FieldPathByValue<TFieldValues, TValue>

FieldPathByValue<TFieldValues, TValue> = { [Key in FieldPath<TFieldValues>]: FieldPathValue<TFieldValues, Key> extends TValue ? Key : never }[FieldPath<TFieldValues>]

Defined in: node_modules/.pnpm/react-hook-form@7.86.0_react@19.2.8/node_modules/react-hook-form/dist/types/path/eager.d.ts:122

Type which eagerly collects all paths through a fieldType that matches a give type

Type Parameters

TFieldValues

TFieldValues extends FieldValues

field values which are indexed by the paths

TValue

TValue

the value you want to match into each type

Example

typescript
FieldPathByValue<{foo: {bar: number}, baz: number, bar: string}, number>
  = 'foo.bar' | 'baz'

Released under the MPL-2.0 License.