Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
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