-
-
Notifications
You must be signed in to change notification settings - Fork 483
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Added tsx generic typings for Field, Form, and FormSpy components #522
Conversation
This pull request introduces 1 alert when merging 58fb5f9 into 3dc413a - view on LGTM.com new alerts:
This project has automated code review enabled, but doesn't use the LGTM GitHub App. Migrate over by installing the app. Read about the benefits of migrating to GitHub Apps in the blog. Comment posted by LGTM.com |
Codecov Report
@@ Coverage Diff @@
## master #522 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 15 16 +1
Lines 224 232 +8
Branches 55 57 +2
=====================================
+ Hits 224 232 +8
Continue to review full report at Codecov.
|
typescript/index.d.ts
Outdated
isEqual?: (a: any, b: any) => boolean; | ||
multiple?: boolean; | ||
parse?: (value: any, name: string) => any; | ||
parse?: (value: FieldValue, name: string) => FieldValue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This value
parameter should still be any
, I think, as it's what is returned from the input. i.e. say we had a field of type number
, but we had it in an <input type="text"/>
, the whole point of the parse
function is to do that conversion. I don't think it's a common enough use case to provide an UnparsedValue
generic type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, that's true. Should have though about it a little bit more before I switched that. I'll switch it back to any
.
This is AWESOME. |
Updates for |
This pull request introduces 1 alert when merging db845a0 into 3dc413a - view on LGTM.com new alerts:
This project has automated code review enabled, but doesn't use the LGTM GitHub App. Migrate over by installing the app. Read about the benefits of migrating to GitHub Apps in the blog. Comment posted by LGTM.com |
Chad! My man!! 👍 |
This pull request introduces 1 alert when merging 730d7aa into 02bf898 - view on LGTM.com new alerts:
This project has automated code review enabled, but doesn't use the LGTM GitHub App. Migrate over by installing the app. Read about the benefits of migrating to GitHub Apps in the blog. Comment posted by LGTM.com |
Published in |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
As mentioned in #516 (comment), this should now allow for TSX generics for
Field
,Form
, andFormSpy
. This should allow you to pass in a type to either of these components, or in the case of theForm
component if you pass in a typedinitialValues
prop typescript will infer the type.For example: