[@mantine/form] make Values and TransformedValues covariant#8198
Open
jvllmr wants to merge 8 commits intomantinedev:masterfrom
Open
[@mantine/form] make Values and TransformedValues covariant#8198jvllmr wants to merge 8 commits intomantinedev:masterfrom
jvllmr wants to merge 8 commits intomantinedev:masterfrom
Conversation
This allows passing a form to a func which accepts a form with only selected fields of the original form Signed-off-by: Jan Vollmer <jan@vllmr.dev>
Signed-off-by: Jan Vollmer <jan@vllmr.dev>
Signed-off-by: Jan Vollmer <jan@vllmr.dev>
Signed-off-by: Jan Vollmer <jan@vllmr.dev>
Signed-off-by: Jan Vollmer <jan@vllmr.dev>
Contributor
Author
|
I also looked into improved inference and value passing for the TransformValues / TransformedValues type, but I think for that TransformValues must be removed in favor of using only TransformedValues. But that would be a breaking change. I could start to create a draft PR for v9 though if there is interest. |
Contributor
Author
|
@rtivital could you already take a look at this PR? Would be happy about any feedback. |
Member
|
Yes, I've reviewed it, but I do not fully understand the new TS syntax ( |
Contributor
Author
|
Okay, take your time 👍🏻 Thanks for letting me know. |
Signed-off-by: Jan Vollmer <jan@vllmr.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This allows type-safely passing a form to a func which accepts a form with only selected fields of the original form.
Here an example:
Related discussions:
This is just a proposal. Feel free to close the PR if you'd like.
I needed to create a new UseFormReturnType, but kept the old one around so that no breaking changes are made.
Edit: It is possible without an extra type