From f4923d6a0a32d33c92fcb37f5daf922b45c99901 Mon Sep 17 00:00:00 2001 From: Armin Mehinovic <4390250+arminmeh@users.noreply.github.com> Date: Mon, 27 Jan 2025 09:19:54 +0100 Subject: [PATCH] [DataGridPro] Fix the return type of `useGridApiRef` for Pro and Premium packages on React < 19 (#16328) --- .../x-data-grid-premium/src/hooks/utils/useGridApiRef.ts | 6 ++++-- packages/x-data-grid-pro/src/hooks/utils/useGridApiRef.ts | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/x-data-grid-premium/src/hooks/utils/useGridApiRef.ts b/packages/x-data-grid-premium/src/hooks/utils/useGridApiRef.ts index 0ab61cb18d3e0..708fc36b459ed 100644 --- a/packages/x-data-grid-premium/src/hooks/utils/useGridApiRef.ts +++ b/packages/x-data-grid-premium/src/hooks/utils/useGridApiRef.ts @@ -1,4 +1,6 @@ -import { useGridApiRef as useCommunityGridApiRef } from '@mui/x-data-grid'; +import { RefObject } from '@mui/x-internals/types'; +import { GridApiCommon, useGridApiRef as useCommunityGridApiRef } from '@mui/x-data-grid'; import { GridApiPremium } from '../../models/gridApiPremium'; -export const useGridApiRef = useCommunityGridApiRef; +export const useGridApiRef: () => RefObject = + useCommunityGridApiRef; diff --git a/packages/x-data-grid-pro/src/hooks/utils/useGridApiRef.ts b/packages/x-data-grid-pro/src/hooks/utils/useGridApiRef.ts index 47d74e0b6a051..0828c9a98bddb 100644 --- a/packages/x-data-grid-pro/src/hooks/utils/useGridApiRef.ts +++ b/packages/x-data-grid-pro/src/hooks/utils/useGridApiRef.ts @@ -1,4 +1,6 @@ -import { useGridApiRef as useCommunityGridApiRef } from '@mui/x-data-grid'; +import { RefObject } from '@mui/x-internals/types'; +import { GridApiCommon, useGridApiRef as useCommunityGridApiRef } from '@mui/x-data-grid'; import { GridApiPro } from '../../models/gridApiPro'; -export const useGridApiRef = useCommunityGridApiRef; +export const useGridApiRef: () => RefObject = + useCommunityGridApiRef;