From 36bc283d2f5cfdf9ecd3be5dcfd8a55c1b82c7ef Mon Sep 17 00:00:00 2001 From: Wlad Meixner Date: Sat, 4 Apr 2020 22:44:27 +0200 Subject: [PATCH] fix: remove optional chaining, change TS version --- .../react-bootstrap-table2-filter/index.d.ts | 2 +- .../react-bootstrap-table2-filter-tests.tsx | 23 ++++--------------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/types/react-bootstrap-table2-filter/index.d.ts b/types/react-bootstrap-table2-filter/index.d.ts index b68665f240..921891e088 100644 --- a/types/react-bootstrap-table2-filter/index.d.ts +++ b/types/react-bootstrap-table2-filter/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/react-bootstrap-table/react-bootstrap-table2#readme // Definitions by: Wlad Meixner // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.7 +// TypeScript Version: 3.0 // documentation taken from https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/table-props.html diff --git a/types/react-bootstrap-table2-filter/react-bootstrap-table2-filter-tests.tsx b/types/react-bootstrap-table2-filter/react-bootstrap-table2-filter-tests.tsx index f67fff1cf4..55a3136392 100644 --- a/types/react-bootstrap-table2-filter/react-bootstrap-table2-filter-tests.tsx +++ b/types/react-bootstrap-table2-filter/react-bootstrap-table2-filter-tests.tsx @@ -211,7 +211,10 @@ const selectColumns = [ { dataField: 'quality', text: 'Product Quailty', - formatter: (cell: number) => selectOptionsList.find(val => val.value === cell)?.value ?? '', + formatter: (cell: number) => { + const found = selectOptionsList.find(val => val.value === cell); + return found ? found.value : ''; + }, filter: selectFilter({ options: selectOptionsList, className: 'test-classname', @@ -226,24 +229,6 @@ const selectColumns = [ onFilter: filterValue => {}, }), }, - { - dataField: 'quality', - text: 'Product Quailty', - formatter: (cell: number) => selectOptionsList.find(val => val.value === cell)?.value ?? '', - filter: selectFilter({ - options: selectOptionsCreator, - className: 'test-classname', - withoutEmptyOption: true, - defaultValue: 2, - comparator: Comparator.LIKE, // default is Comparator.EQ - style: { backgroundColor: 'pink' }, - getFilter: filter => { - // qualityFilter was assigned once the component has been mounted. - qualityFilter = filter; - }, - onFilter: filterValue => {}, - }), - }, ]; render( ,