From cc1f1be8bd88bdd6fecb6778c51790d2e21a0051 Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 18 Nov 2016 11:31:02 +0800 Subject: [PATCH] fix ts error --- components/table/filterDropdown.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/components/table/filterDropdown.tsx b/components/table/filterDropdown.tsx index 32f5e36a6a..2c16b1e38b 100755 --- a/components/table/filterDropdown.tsx +++ b/components/table/filterDropdown.tsx @@ -39,16 +39,17 @@ export default class FilterMenu extends React.Component { componentWillReceiveProps(nextProps) { const { column } = nextProps; - let newState; + let newState: { + selectedKeys?: string[]; + visible?: boolean; + } = {}; if ('selectedKeys' in nextProps) { - newState = newState || {}; newState.selectedKeys = nextProps.selectedKeys; } if ('filterDropdownVisible' in column) { - newState = newState || {}; newState.visible = column.filterDropdownVisible; } - if (newState) { + if (Object.keys(newState).length > 0) { this.setState(newState); } }