-
Notifications
You must be signed in to change notification settings - Fork 397
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
Problem with Flow typing of withI18nProps: suppressed errors #210
Comments
Hi @tricoder42 , Sorry, I meant to write earlier that the real issue was that the distribution of I was wondering whether you might want to consider distributing your Flow types along with the library. I am not sure what the best practices for such a distribution are — I know only that the guys at |
Flow types are included in npm packages since release 2.4.0 |
@tricoder42, was adding |
I have come across an unusual problem when using
js-lingui
's Flow types. Creating an intersection type between a regular component props object andwithI18nProps
type leaves Flow unable to detect errors when using this props object.I have created a minimal reproduction case here, but briefly an example can be recreated like this:
import
withI18nProps
type from@lingui/react
intersect the
Props
type with thewithI18nProps
type:or, alternatively, spread the
withI18nProps
type in theProps
object type:in the React component, try to access a property not declared in the
Props
type (e.g.this.props.x
)notice that Flow is not marking this as an error
remove
withI18nProps
from the intersection (or from the object where it was spread) and notice that Flow now catches the error of accessing the non-declared property.I could not replicate the problem as a cleaner and smaller case in
try Flow
, but I hope the provided info will be enough to help you find the problem.The text was updated successfully, but these errors were encountered: