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

Unable to update from v1.1.5 to v1.2.x due to type issues #799

Open
anthonyhagi opened this issue Oct 6, 2024 · 0 comments
Open

Unable to update from v1.1.5 to v1.2.x due to type issues #799

anthonyhagi opened this issue Oct 6, 2024 · 0 comments

Comments

@anthonyhagi
Copy link

Describe the bug and the expected behavior

Updating from v1.2.0+ results in a type issue as follows:

app/routes/auth.register/route.tsx:80:5 - error TS2322: Type '({ formData }: { form: HTMLFormElement; submitter: HTMLInputElement | HTMLButtonElement | null; formData: FormData; }) => Submission<...>' is not assignable to type '(context: { form: HTMLFormElement; submitter: HTMLInputElement | HTMLButtonElement | null; formData: FormData; }) => Submission<...>'.
  Type 'Submission<{ email: string; password: string; firstName: string; lastName: string; passwordConfirm: string; }, string[], { email: string; password: string; firstName: string; lastName: string; passwordConfirm: string; }>' is not assignable to type 'Submission<Record<string, any>, string[], Record<string, any>>'.
    Type '{ status: "error" | undefined; payload: Record<string, unknown>; error: Record<string, string[] | null> | null; reply(options?: ReplyOptions<string[]> | undefined): SubmissionResult<...>; }' is not assignable to type 'Submission<Record<string, any>, string[], Record<string, any>>'.
      Type '{ status: "error" | undefined; payload: Record<string, unknown>; error: Record<string, string[] | null> | null; reply(options?: ReplyOptions<string[]> | undefined): SubmissionResult<...>; }' is not assignable to type '{ status: "error" | undefined; payload: Record<string, SubmissionPayload<FormDataEntryValue>>; error: Record<string, string[] | null> | null; reply(options?: ReplyOptions<...> | undefined): SubmissionResult<...>; }'.
        Types of property 'payload' are incompatible.
          Type 'Record<string, unknown>' is not assignable to type 'Record<string, SubmissionPayload<FormDataEntryValue>>'.
            'string' index signatures are incompatible.
              Type 'unknown' is not assignable to type 'SubmissionPayload<FormDataEntryValue>'.

80     onValidate({ formData }) {
       ~~~~~~~~~~

  node_modules/@conform-to/react/node_modules/@conform-to/dom/form.d.ts:90:5
    90     onValidate?: (context: {
           ~~~~~~~~~~
    The expected type comes from property 'onValidate' which is declared here on type '{ defaultValue?: { [x: string]: any; } | null | undefined; onSubmit?: ((event: FormEvent<HTMLFormElement>, context: { formData: FormData; action: string; encType: "application/x-www-form-urlencoded" | "multipart/form-data"; method: "POST" | ... 3 more ... | "DELETE"; submission?: Submission<...> | undefined; }) => v...'

I'm not sure why the types are not matching up anymore

Conform version

v1.2.x

Steps to Reproduce the Bug or Issue

  1. Set up a brand new Remix project
  2. Follow the Remix guide here (https://conform.guide/integration/remix)
  3. Install shadcn/ui components and bring in the input.tsx file (or any other) from here (https://github.com/edmundhung/conform/blob/main/examples/shadcn-ui/src/components/conform/Input.tsx)

What browsers are you seeing the problem on?

No response

Screenshots or Videos

No response

Additional context

This has been working completely fine before v1.2.x. shadcn/ui components don't seem to be the cause of the issue

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

1 participant