Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expanding FieldBag and useForm #2665

Open
1 of 2 tasks
AntanasGa opened this issue Jul 3, 2023 · 0 comments
Open
1 of 2 tasks

Expanding FieldBag and useForm #2665

AntanasGa opened this issue Jul 3, 2023 · 0 comments
Labels
Type: Feature Request 🙌 Request a new feature or changes to an existing one

Comments

@AntanasGa
Copy link

AntanasGa commented Jul 3, 2023

Overview

When working on projects i expect some types to be shared between back end and front end, meaning that if i want the type to change in one, I'll have to check over the other.

the suggested changes would be:

export function useForm<
  T extends object,
  V extends FieldBag = T extends FieldBag
    ? T
    : {
        [K in keyof T]: FieldOutput<T[K]>;
      },
>({
  fields,
  onSubmit,
  makeCleanAfterSubmit,
}: FormWithoutDynamicListsInput<V>): Form<V>;
export type FieldOutput<T> = T extends object
  ? T extends any[]
    ? FieldDictionary<T>[]
    : FieldDictionary<T>
  : Field<T>;

Type

  • New feature
  • Changes to existing features
@AntanasGa AntanasGa added the Type: Feature Request 🙌 Request a new feature or changes to an existing one label Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature Request 🙌 Request a new feature or changes to an existing one
Projects
None yet
Development

No branches or pull requests

1 participant