Skip to content

Commit

Permalink
Fix Flowtyping
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Schultz committed May 24, 2018
1 parent 6202304 commit 61f3cba
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/pages/upgradeGuide/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ class PropChanges extends Component<
{ selectedOptions: Array<string>, filterValue: string }
> {
state = {
selectedOptions: allOptions.map(opt => opt.value),
selectedOptions: (allOptions.map(opt => opt.value): Array<string>),
filterValue: filterOptions[0].value,
};

Expand Down
1 change: 1 addition & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const globals = {
'react-input-autosize': 'AutosizeInput',
react: 'React',
};
// $FlowFixMe This should be inferred by Flow and manual casting does not work inside of this config.
const external = Object.keys(globals);
const babelOptions = () => {
let result = {
Expand Down
3 changes: 2 additions & 1 deletion src/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {

import {
defaultComponents,
type PlaceholderOrValue,
type SelectComponents,
type SelectComponentsConfig,
} from './components/index';
Expand Down Expand Up @@ -1141,7 +1142,7 @@ export default class Select extends Component<Props, State> {
/>
);
}
renderPlaceholderOrValue() {
renderPlaceholderOrValue(): ?PlaceholderOrValue {
const {
MultiValue,
MultiValueContainer,
Expand Down
10 changes: 9 additions & 1 deletion src/components/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// @flow
import type { ComponentType } from 'react';
import {
type ComponentType,
type Element,
} from 'react';
import {
type IndicatorContainerProps,
type ContainerProps,
Expand Down Expand Up @@ -42,6 +45,11 @@ import Option, { type OptionProps } from './Option';
import Placeholder, { type PlaceholderProps } from './Placeholder';
import SingleValue, { type SingleValueProps } from './SingleValue';

export type PlaceholderOrValue =
| Element<ComponentType<PlaceholderProps>>
| Element<ComponentType<SingleValueProps>>
| Array<Element<ComponentType<MultiValueProps>>>

type IndicatorComponentType = ComponentType<IndicatorProps>;

export type SelectComponents = {
Expand Down

0 comments on commit 61f3cba

Please sign in to comment.