Reputation: 8090
The React flow definitions seem to change between versions
eg. for React version 15.6.1, PureComponent has the definition
declare class React$PureComponent<DefaultProps, Props, State> extends React$Component<DefaultProps, Props, State> {
// TODO: Due to bugs in Flow's handling of React.createClass, some fields
// already declared in the base class need to be redeclared below. Ideally
// they should simply be inherited.
static defaultProps: $Abstract<DefaultProps>;
props: Props;
state: $Abstract<State>;
}
but the current definition is
declare class React$PureComponent<Props, State = void>
extends React$Component<Props, State> {
// TODO: Due to bugs in Flow's handling of React.createClass, some fields
// already declared in the base class need to be redeclared below. Ideally
// they should simply be inherited.
props: Props;
state: State;
}
the change was in https://github.com/facebook/flow/releases/tag/v0.53.0
The question is how to get the flow definations for my version of React
flow-typed install [email protected]
does not work as well
another question is, my package.json
has a dependency on flow-bin so where are these changes coming from ?
Upvotes: 0
Views: 325
Reputation: 2287
The flow version is not specifically tied to a React version. The changes to the type of Component
and PureComponent
are improvements in the way Flow types them in Flow v0.53, regardless of what version of React you use.
If you want the old types, any React and Flow < 0.53 will work. If you want the new version, any React and Flow >= 0.53 will work.
There's a rundown of why this was changed and what you need to do in your code in this blog post on Flow 0.53: https://medium.com/flow-type/even-better-support-for-react-in-flow-25b0a3485627
Upvotes: 1