fix ts error

This commit is contained in:
afc163 2016-11-18 11:31:02 +08:00
parent a6e09ccfd0
commit cc1f1be8bd

View File

@ -39,16 +39,17 @@ export default class FilterMenu extends React.Component<FilterMenuProps, any> {
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
const { column } = nextProps; const { column } = nextProps;
let newState; let newState: {
selectedKeys?: string[];
visible?: boolean;
} = {};
if ('selectedKeys' in nextProps) { if ('selectedKeys' in nextProps) {
newState = newState || {};
newState.selectedKeys = nextProps.selectedKeys; newState.selectedKeys = nextProps.selectedKeys;
} }
if ('filterDropdownVisible' in column) { if ('filterDropdownVisible' in column) {
newState = newState || {};
newState.visible = column.filterDropdownVisible; newState.visible = column.filterDropdownVisible;
} }
if (newState) { if (Object.keys(newState).length > 0) {
this.setState(newState); this.setState(newState);
} }
} }