Skip to content

fix: TS types#165

Merged
AlemTuzlak merged 2 commits intocode-forge-io:mainfrom
dkAndFed:fix/TS-types
Apr 9, 2025
Merged

fix: TS types#165
AlemTuzlak merged 2 commits intocode-forge-io:mainfrom
dkAndFed:fix/TS-types

Conversation

@dkAndFed
Copy link
Copy Markdown

@dkAndFed dkAndFed commented Apr 8, 2025

Description

Fixes the generics on some utils as the Resolver type in react-hook-form has changed.

Fixes #164

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Unit tests
  • Consume

Checklist:

  • My code follows the guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 8, 2025

Open in StackBlitz

npm i https://pkg.pr.new/forge-42/remix-hook-form@165

commit: b66a123

@AlemTuzlak
Copy link
Copy Markdown
Contributor

Thank you for this, does this mean it will be possible for these utilities to infer the return type without passing in the type?

@dkAndFed
Copy link
Copy Markdown
Author

dkAndFed commented Apr 8, 2025

Thank you for this, does this mean it will be possible for these utilities to infer the return type without passing in the type?

I believe passing the type was no longer necessary since version 4 of @hookform/resolvers. Edit: since 4.1.0

This PR fixes the use of types for the utils. The data should now correctly reflect the transformed values.

In the screenshot below, before the fix the preprocess would return unknown as opposed to string.

image

@AlemTuzlak
Copy link
Copy Markdown
Contributor

@dkAndFed thank you so much for this! I was trying to,get it to work the other day and,couldn't figure out how to get it to work.

@dkAndFed
Copy link
Copy Markdown
Author

dkAndFed commented Apr 8, 2025

@AlemTuzlak I haven't looked at the React specific utils, yet, but they might need to receive similar treatment. 🤔

@AlemTuzlak
Copy link
Copy Markdown
Contributor

They already work, it was just the server parts!

@dkAndFed
Copy link
Copy Markdown
Author

dkAndFed commented Apr 8, 2025

They already work, it was just the server parts!

Let me push some changes to the branch and you will see. Should be a minute.

Edit: @AlemTuzlak pushed the React changes as well. Now it should be aligned with react-hook-form types

@dkAndFed
Copy link
Copy Markdown
Author

dkAndFed commented Apr 9, 2025

@AlemTuzlak

When do you think you will be able to merge and release this? Let me know if you need some assistance with something.

@AlemTuzlak
Copy link
Copy Markdown
Contributor

Very soon!

@AlemTuzlak AlemTuzlak merged commit 7523369 into code-forge-io:main Apr 9, 2025
4 checks passed
@AlemTuzlak
Copy link
Copy Markdown
Contributor

Released, again thank you so much, turns out the reason I couldn't get it to work is because I was testing it with resolvers v4 lol.

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

Successfully merging this pull request may close these issues.

Support for @hookform/resolvers 5.0.1 ?

2 participants