You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With react and flow, it's very common to type props like this:
typeProps={prop1: string,prop2: number};
However this makes it possible to pass other props as well, as by default objects in Flow are not exact. So this can hide an issue where the developer removed a prop but the caller still use it:
<Componentprop1='foo'prop2={42}prop3='bar'/>
Or made a typo (this example is possible is prop2 is optional):
<Componentprop1='foo'porp2={42}/>
To fix this with flow, the solution is to use exact objects:
typeProps={|prop1: string,prop2: number|};
It would be useful to have an eslint rule to force this pattern.
The text was updated successfully, but these errors were encountered:
I'm a bit hesitant to have Flow-only rules in a non-flow-specific eslint plugin, but I agree that such a rule would be a good thing to have if using Flow.
With react and flow, it's very common to type props like this:
However this makes it possible to pass other props as well, as by default objects in Flow are not exact. So this can hide an issue where the developer removed a prop but the caller still use it:
Or made a typo (this example is possible is
prop2
is optional):To fix this with flow, the solution is to use exact objects:
It would be useful to have an eslint rule to force this pattern.
The text was updated successfully, but these errors were encountered: