Closed
Description
With react and flow, it's very common to type props like this:
type Props = {
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:
<Component prop1='foo' prop2={42} prop3='bar' />
Or made a typo (this example is possible is prop2
is optional):
<Component prop1='foo' porp2={42} />
To fix this with flow, the solution is to use exact objects:
type Props = {|
prop1: string,
prop2: number
|};
It would be useful to have an eslint rule to force this pattern.