-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Flow] Can't "import { type FormProps } from 'redux-form';" #3823
Comments
@erikras this is becoming a bit of a blocker on a project I'm currently working on - would be happy to submit a PR but would be nice to hear your thoughts on this first because it seems to be a fundamental issue with the way types are exported/published in this library, and I could make a quick-fix for this isolated case but I wouldn't be confident that there wouldn't be any regression. Also, there's already an open PR for a simple Flow fix, and it's sat there unresolved now for about 3 weeks and I'd need some kind of indication that you'd be able to review/merge/deploy a bit more promptly than that. |
@erikras - final offer! Would you like help safely publishing flow types or no?? |
Hi @ryami333, please submit us the PR if you can find the fix for it. |
It's not a 'fix' so much as a total overhaul is required to the way types are maintained and published in this package. This is why I'd like some engagement before I begin work on it, because it's non-trivial to implement. I've used |
@ryami333 also worth noting that so currently https://github.com/erikras/redux-form/blob/master/src/types.js.flow#L93 |
This issue should be renamed "Broken Flow types import" or something, because it's not specific to FormProps 😢 |
For import { type FieldProps } from 'redux-form/es/FieldProps.types.js.flow' |
Documentation states that 'FormProps' is what's passed *to* a component wrapped with reduxForm(); however, what was exported here was the props that should be passed *by* a user *to* the <Form> component. Switched to using the same naming convention as is already used for other prop-types with the same potential for confusion: exported 'FieldProps' for the props Field passes to user components, and non-exported FieldInputProps for the props Field expects to get from its callers. Fixes redux-form#3823.
@JalilArfaoui Importing FieldProps works for me; FormProps does not, and the reason it doesn't is not applicable to FieldProps. I suspect there's something specific to your setup. What's the exact way in which it doesn't work? You're getting an incorrect type definition, or Flow is ignoring the type altogether? |
Documentation states that 'FormProps' is what's passed *to* a component wrapped with reduxForm(); however, what was exported here was the props that should be passed *by* a user *to* the <Form> component. Switched to using the same naming convention as is already used for other prop-types with the same potential for confusion: exported 'FieldProps' for the props Field passes to user components, and non-exported FieldInputProps for the props Field expects to get from its callers. Fixes redux-form#3823.
I think the author is planning to move to TypeScript because Flow types in this project just don't work very well. For example, if you wrap your component with any HOC ( I have to write my own types for HOC and other components. I want to join @ryami333 point of understanding whether this project wants to continue using Flow or it is better just to export them to flow-typed and maintain them there by the community. |
@mike1808 TBH I think author is not planning to do anything active with this package, besides merging pull requests. |
* index.js.flow: Use re-export syntax instead of import/export pair Minor convenience to the reader (no underscores to distinguish) and writer (less characters). * index.js.flow: Export FormProps we pass *to* components Documentation states that 'FormProps' is what's passed *to* a component wrapped with reduxForm(); however, what was exported here was the props that should be passed *by* a user *to* the <Form> component. Switched to using the same naming convention as is already used for other prop-types with the same potential for confusion: exported 'FieldProps' for the props Field passes to user components, and non-exported FieldInputProps for the props Field expects to get from its callers. Fixes #3823.
Published fix 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. |
This appears to be because
Form.js.flow
is not published. Inindex.js.flow
there are these relevant lines:However
./Form
will not resolve to a.flow
file, because one does not exist innode_modules/redux_form/es
ornode_modules/redux-form/lib
.This means that these docs are actually all incorrect: https://redux-form.com/7.3.0/docs/flow.md/. You can however workaround this by using this instead:
The text was updated successfully, but these errors were encountered: