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>]
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'