From b30a765e53aa8f02463049c560123f2ccde29a45 Mon Sep 17 00:00:00 2001 From: Andrew Cherniavskyi Date: Thu, 9 Nov 2023 10:08:41 +0100 Subject: [PATCH] avoid typing function arguments --- .../grid/x-data-grid/src/colDef/gridNumericOperators.ts | 8 +++++--- .../grid/x-data-grid/src/colDef/gridStringOperators.ts | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/grid/x-data-grid/src/colDef/gridNumericOperators.ts b/packages/grid/x-data-grid/src/colDef/gridNumericOperators.ts index d8e6dcf73958a..ced58577c0ee9 100644 --- a/packages/grid/x-data-grid/src/colDef/gridNumericOperators.ts +++ b/packages/grid/x-data-grid/src/colDef/gridNumericOperators.ts @@ -1,7 +1,7 @@ import { GridFilterInputValue } from '../components/panel/filterPanel/GridFilterInputValue'; import { GridFilterInputMultipleValue } from '../components/panel/filterPanel/GridFilterInputMultipleValue'; import { GridFilterOperator } from '../models/gridFilterOperator'; -import type { GridApplyQuickFilter } from '../models/colDef/gridColDef'; +import type { GetApplyQuickFilterFn } from '../models/colDef/gridColDef'; const parseNumericValue = (value: unknown) => { if (value == null) { @@ -11,12 +11,14 @@ const parseNumericValue = (value: unknown) => { return Number(value); }; -export const getGridNumericQuickFilterFn = (value: any): GridApplyQuickFilter | null => { +export const getGridNumericQuickFilterFn: GetApplyQuickFilterFn = ( + value, +) => { if (value == null || Number.isNaN(value) || value === '') { return null; } - return (columnValue): boolean => { + return (columnValue) => { return parseNumericValue(columnValue) === parseNumericValue(value); }; }; diff --git a/packages/grid/x-data-grid/src/colDef/gridStringOperators.ts b/packages/grid/x-data-grid/src/colDef/gridStringOperators.ts index 33e6a894f553a..5d35dc96e6965 100644 --- a/packages/grid/x-data-grid/src/colDef/gridStringOperators.ts +++ b/packages/grid/x-data-grid/src/colDef/gridStringOperators.ts @@ -1,17 +1,17 @@ import { GridFilterInputValue } from '../components/panel/filterPanel/GridFilterInputValue'; import { escapeRegExp } from '../utils/utils'; -import type { GridApplyQuickFilter } from '../models/colDef/gridColDef'; +import type { GetApplyQuickFilterFn } from '../models/colDef/gridColDef'; import { GridFilterItem } from '../models/gridFilterItem'; import { GridFilterOperator } from '../models/gridFilterOperator'; import { GridFilterInputMultipleValue } from '../components/panel/filterPanel/GridFilterInputMultipleValue'; import { removeDiacritics } from '../hooks/features/filter/gridFilterUtils'; -export const getGridStringQuickFilterFn = (value: any): GridApplyQuickFilter | null => { +export const getGridStringQuickFilterFn: GetApplyQuickFilterFn = (value) => { if (!value) { return null; } const filterRegex = new RegExp(escapeRegExp(value), 'i'); - return (_, row, column, apiRef): boolean => { + return (_, row, column, apiRef) => { let columnValue = apiRef.current.getRowFormattedValue(row, column); if (apiRef.current.ignoreDiacritics) { columnValue = removeDiacritics(columnValue);