-
-
Notifications
You must be signed in to change notification settings - Fork 495
Open
Description
Hi @erikras,
First, thank you for maintaining this library and for the Flow β TypeScript migration! π
The release notes for v7.0.0 state "There should be NO BREAKING CHANGES", but we encountered several TypeScript breaking changes during our migration from v6.5.7 to v7.0.0.
Here's a comprehensive list:
react-final-form v7.0.0
| Change | Impact | Fix |
|---|---|---|
| FormState.values can now be undefined | All usages of values.property fail | Use values?.property or values ?? {} |
| FormState.dirty, pristine, valid, etc. can be undefined | Boolean checks fail (e.g., dirty && ...) | Use dirty ?? false |
| FieldMetaState type is no longer exported | Import fails | Use FieldRenderProps<T>['meta'] instead |
| AnyObject type is no longer exported | Import fails | Define locally: type AnyObject = Record<string, any> |
| UseFieldConfig is no longer generic | UseFieldConfig<T> fails |
Use UseFieldConfig (no generic) |
| FormProps no longer accepts arbitrary props like style | fails | Wrap with a <div style={...}> |
final-form v5.0.0
| Change | Impact | Fix |
|---|---|---|
| InternalFormState now requires asyncErrors property | Test mocks fail | Add asyncErrors: {} to mock objects |
| Mutator type signature changed | Jest mocks incompatible | Cast with as unknown as Mutator |
Migration effort
For our medium-sized codebase, we had to modify 170+ files. The changes are straightforward but numerous.
Suggestion
It would be helpful to either:
- Document these TypeScript changes in the release notes
- Or add a migration guide for TypeScript users
Environment:
- react-final-form: 6.5.7 β 7.0.0
- final-form: 4.20.4 β 5.0.0
- TypeScript: 5.5.4
Metadata
Metadata
Assignees
Labels
No labels