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

getButtonProps doesn't accept custom errors #791

Open
brunobely opened this issue Sep 24, 2024 · 1 comment
Open

getButtonProps doesn't accept custom errors #791

brunobely opened this issue Sep 24, 2024 · 1 comment

Comments

@brunobely
Copy link

Describe the bug and the expected behavior

When trying to get the update button props for a field, custom errors can't be used due to a type mismatch in getButtonProps:

Type 'FieldName<FieldSchema, FormSchema, Error>' is not assignable to type 'FieldName<FieldSchema>'.

Conform version

v1.2.1

Steps to Reproduce the Bug or Issue

Use a custom component:

function ExampleComponent<
  FieldSchema,
  FormSchema extends Record<string, unknown>,
  Error = string[]
>({
  name,
}: {
  name: FieldName<FieldSchema, FormSchema, Error>;
}) {
  const [meta, field] = 
  return (
    <button
      {...form.update.getButtonProps({
        name: field.name,
        // ^~ Type 'FieldName<FieldSchema, FormSchema, Error>' is not assignable to type 'FieldName<FieldSchema>'.
        value: {
          title: 'My agenda',
          description: 'This is my agenda',
        },
      })}
    >Update
    </button>
  );
}

What browsers are you seeing the problem on?

No response

Screenshots or Videos

No response

Additional context

No response

@Pouet--
Copy link

Pouet-- commented Oct 10, 2024

Can you provide a repo for testing ?
I remember having this problem back then, solved by writing my props as FieldName<FieldSchema> and not FieldName<FieldSchema, FormSchema, Error>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants