T
TanStack•4mo ago
graceful-beige

Why AppFieldExtendedReactFormApi type is not exported?

While we have fieldComponents & formComponents, we might need also formCallbacks or at least exported AppFieldExtendedReactFormApi type. In our application form has effect in whole page, so in v0 of Forms i put created form to a context and used in many places, avoiding prop drilling. Now useAppForm returns value of AppFieldExtendedReactFormApi type. And I need to redeclare it locally. What was the reason to not exporting AppFieldExtendedReactFormApi?
2 Replies
absent-sapphire
absent-sapphire•4mo ago
This came up before - see here: https://discord.com/channels/719702312431386674/1100437019857014895/1367474829959102555 We're also in the "Tables"-Section of the Discord 🙈
graceful-beige
graceful-beigeOP•4mo ago
Shame on me 🙂 Thanks @ksgn Eventually with help of colleagues nice solution was found:
export const useForm = <T>(formOpts: {
defaultValues: T;
}) => {
return useAppForm(formOpts);
};

export type Form<T> = ReturnType<typeof useForm<T>>;
export const useForm = <T>(formOpts: {
defaultValues: T;
}) => {
return useAppForm(formOpts);
};

export type Form<T> = ReturnType<typeof useForm<T>>;

Did you find this page helpful?