toFieldPath
Gives a field's Formisch path: its dataPath with each '*' replaced by the index of the list item it is in, outermost first.
ts
const path = toFieldPath(dataPath, indexes)Parameters
dataPathreadonly (string | number)[]indexesreadonly number[]
Explanation
toFieldPath(['lines', '*', 'quantity'], [2]) is ['lines', 2, 'quantity']. A path with more '*' than indexes is a mistake in the code, so it throws a TypeError. The path comes from the definition at runtime, so pass it to Formisch as never.
Returns
pathFieldPath
FieldPath
ts
type FieldPath = readonly (string | number)[]A field's Formisch path, with real indexes: ['lines', 0, 'quantity'].