[Flow202][web][skip-ci] [20/x] Fix Flow issues in ComposedMessage
Summary:
The new version of Flow is printing this error:
Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ chat/composed-message.react.js:60:50 Cannot use variable ComposedMessage [1] because the declaration either comes later or was skipped. [reference-before-declaration] 57│ +fixedWidth?: boolean, 58│ +borderRadius: number, 59│ }; 60│ type BaseConfig = React.Config<BaseProps, typeof ComposedMessage.defaultProps>; 61│ type Props = { 62│ ...BaseProps, 63│ // withInputState : [1] 71│ class ComposedMessage extends React.PureComponent<Props> {
To get around it, I extracted the type of defaultProps into its own declaration, and then used that type directly.
NOTE: CI will fail on this diff. I considered the possibility of fixing Flow errors BEFORE upgrading Flow, but it wasn't possible... in some cases, the fixes to support the new version of Flow caused errors in the old version. I could have hidden these type errors with $FlowFixMe lines and then later revert those, but that seemed like too much busy work.
Depends on D9785
Test Plan: Confirm the Flow errors go away
Reviewers: tomek
Reviewed By: tomek
Subscribers: wyilio
Differential Revision: https://phab.comm.dev/D9786