Hello! Sorry for removing the issue template.
I upgraded my project to Flow 0.99.0 from 0.98.1, and discovered that it throws new errors for this library.
Would you accept a PR fixing them?
It seems we hit this new feature from 0.99.0
Fix an issue where Flow would not catch certain errors involving React function components with unannotated props.
Errors:
Error โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ node_modules/react-select/src/Select.js:442:23
Cannot assign defaultComponents(...) to this.components because:
โข property children is missing in props [1] but exists in object type [2] in property Menu.
โข property innerRef is missing in props [1] but exists in object type [2] in property Menu.
node_modules/react-select/src/Select.js
439โ document.removeEventListener('scroll', this.onScroll, true);
440โ }
441โ cacheComponents = (components: SelectComponents) => {
442โ this.components = defaultComponents({ components });
443โ };
444โ // ==============================
445โ // Consumer Handlers
node_modules/react-select/src/components/Menu.js
[2] 225โ export type MenuProps = MenuAndPlacerCommon & {
226โ /** Reference to the internal element, consumed by the MenuPlacer component */
227โ innerRef: ElementRef<*>,
228โ /** The children to be rendered. */
229โ children: ReactElement<*>,
230โ };
node_modules/react-select/src/components/index.js
[1] 64โ Menu: ComponentType<MenuProps>,
Error โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ node_modules/react-select/src/animated/MultiValue.js:12:10
Cannot return function because:
โข property in is missing in props [1].
โข property onExited is missing in props [1].
9โ const AnimatedMultiValue = (
10โ WrappedComponent: AbstractComponent<MultiValueProps>
[1] 11โ ): AbstractComponent<MultiValueProps> => {
12โ return ({ in: inProp, onExited, ...props }) => (
13โ <Collapse in={inProp} onExited={onExited}>
14โ <WrappedComponent cropWithEllipsis={inProp} {...props} />
15โ </Collapse>
16โ );
17โ };
18โ
19โ export default AnimatedMultiValue;
Error โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ node_modules/react-select/src/animated/Placeholder.js:11:4
Cannot create Fade element because:
โข property in is missing in props [1] but exists in BaseTransition [2].
โข property onExited is missing in props [1] but exists in BaseTransition [2].
node_modules/react-select/src/animated/Placeholder.js
8โ const AnimatedPlaceholder = (
9โ WrappedComponent: AbstractComponent<PlaceholderProps>
10โ ): AbstractComponent<PlaceholderProps> => (props) => (
[1] 11โ <Fade
12โ component={WrappedComponent}
13โ duration={props.isMulti ? collapseDuration : 1}
14โ {...props}
15โ />
16โ );
17โ
18โ export default AnimatedPlaceholder;
node_modules/react-select/src/animated/transitions.js
[2] 18โ type FadeProps = BaseTransition & {
Error โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ node_modules/react-select/src/animated/SingleValue.js:12:4
Cannot create Fade element because:
โข property duration is missing in props [1] but exists in object type [2].
โข property in is missing in props [1] but exists in BaseTransition [3].
โข property onExited is missing in props [1] but exists in BaseTransition [3].
node_modules/react-select/src/animated/SingleValue.js
9โ const AnimatedSingleValue = (
10โ WrappedComponent: AbstractComponent<SingleValueProps>
11โ ): AbstractComponent<SingleValueProps> => (props) => (
[1] 12โ <Fade component={WrappedComponent} {...props} />
13โ );
14โ
15โ export default AnimatedSingleValue;
node_modules/react-select/src/animated/transitions.js
[3][2] 18โ type FadeProps = BaseTransition & {
19โ component: ComponentType<any>,
20โ duration: number,
21โ };
Error โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ node_modules/react-select/src/animated/index.js:14:10
Cannot return object literal because:
โข property children is missing in props [1] but exists in object type [2] in property Menu.
โข property innerRef is missing in props [1] but exists in object type [2] in property Menu.
node_modules/react-select/src/animated/index.js
11โ const makeAnimated = (externalComponents?: SelectComponents= {}): SelectComponents => {
12โ const components = defaultComponents({ components: externalComponents });
13โ const { Input, MultiValue, Placeholder, SingleValue, ValueContainer, ...rest } = components;
14โ return {
15โ Input: AnimatedInput(Input),
16โ MultiValue: AnimatedMultiValue(MultiValue),
17โ Placeholder: AnimatedPlaceholder(Placeholder),
18โ SingleValue: AnimatedSingleValue(SingleValue),
19โ ValueContainer: AnimatedValueContainer(ValueContainer),
20โ ...rest,
21โ };
22โ };
23โ
24โ const AnimatedComponents = makeAnimated();
node_modules/react-select/src/components/Menu.js
[2] 225โ export type MenuProps = MenuAndPlacerCommon & {
226โ /** Reference to the internal element, consumed by the MenuPlacer component */
227โ innerRef: ElementRef<*>,
228โ /** The children to be rendered. */
229โ children: ReactElement<*>,
230โ };
node_modules/react-select/src/components/index.js
[1] 64โ Menu: ComponentType<MenuProps>,
@montogeek would deeply appreciate a PR to fix this, thanks for raising the issue
In case it helps anyone - we've recently ran into this on a project were integrating the react-select library, and as a temporary fix added the following to the .flowconfig:
[ignore]
.*/node_modules/react-select/.*
However this results in another error where importing the library:
Error โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ src/components/Select/index.js:3:44
Cannot resolve module react-select.
1โ // @flow
2โ import React from 'react';
3โ import Select from 'react-select';
So in addition to the above, mark the import line with $FlowFixMe (all this until #3626 is resolved).
Further to @breadadams comment, we've found that using untyped in our .flowconfig is working well and doesn't require the additional $FlowFixMe's:
[untyped]
<PROJECT_ROOT>/node_modules/react-select/*
Further details at #3804 and #3816
It appears this will be resolved when PR #3626 is merged.
Most helpful comment
In case it helps anyone - we've recently ran into this on a project were integrating the react-select library, and as a temporary fix added the following to the
.flowconfig:However this results in another error where importing the library:
So in addition to the above, mark the import line with
$FlowFixMe(all this until #3626 is resolved).