Whenever I use
MyComponent.defaultProps = {
...something
}
after MyComponent
is created by
class MyComponent extends Component {
...
}
flow gives the error:
object literal. This type is incompatible with undefined
Did you forget to declare type parameter `DefaultProps` of identifier `Component`
This is a bug I would say... suffering the same here at the moment
This is type error. Flow has already inferred the type for your class before you try to mutate the defaultProps property.
And since you didn't give it a type it was inferred as void
.
class MyComponent extends Component {
static defaultProps: Object;
}
This should fix it.
Most helpful comment
This is type error. Flow has already inferred the type for your class before you try to mutate the defaultProps property.
And since you didn't give it a type it was inferred as
void
.This should fix it.