RHFのPath型
from
Paths<R>
https://github.com/react-hook-form/react-hook-form/blob/0b540d0aa16495613ed3164468cd1915fcce4d1e/src/types/path/eager.ts#L22-L30
https://zenn.dev/dqn/articles/59b4f12ad37b6b#解決策
formの定義(record)を渡すと、アクセス可能な
name
を全列挙する
code:ts
type Field = Path<{
foo: string;
bar: number[];
baz: {
a: boolean;
}[];
}>;
// type Field = "foo" | "bar" | "baz" |
bar.${number}
|
baz.${number}
|
baz.${number}.a