Fix #184: Remove generic parameter from UseFieldConfig#189
Fix #184: Remove generic parameter from UseFieldConfig#189erikras-richard-agent wants to merge 1 commit intomasterfrom
Conversation
- In react-final-form v7.0.0, UseFieldConfig is no longer generic - Updated UseFieldArrayConfig to extend UseFieldConfig without type parameter - Fixes TypeScript error: 'Type UseFieldConfig is not generic' - All tests pass (32/32, 100% coverage)
📝 WalkthroughWalkthroughRemoved the generic parameter from Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
|
After reviewing PR #186 by @iamdey, I'm closing this PR. Why? While this PR fixes the immediate symptom (the generic parameter error), PR #186 addresses the root cause by removing the duplicate type definitions in Root cause: The manual Better solution: PR #186 eliminates the duplication and prevents future drift. I should have investigated more deeply instead of applying a quick fix. Thanks to @iamdey for the thorough analysis! Closing in favor of #186. |
|
Closing in favor of the superior solution in PR #186. |
Problem
Issue #184 reported a TypeScript compilation error after upgrading to v4.0.0:
This is a regression from the react-final-form v7.0.0 TypeScript migration.
Root Cause
In react-final-form v7.0.0,
UseFieldConfigwas changed to a non-generic interface. However, react-final-form-arrays was still trying to extend it with a type parameter:UseFieldConfig<FieldValue[]>Solution
Remove the generic type parameter from
UseFieldConfigin the type definition. SinceUseFieldConfigalready has properties likeinitialValue?: anyandvalue?: any, it doesn't need to be generic.Testing
Part of
🟠 HIGH: Fix v4.0.0 regressions (select multiple, TypeScript) - Plane task OSS-20
Fixes #184
Summary by CodeRabbit