I want to extend a component with React/TS (in my case is @mui/x-data-grid DataGrid) to fill the classes prop with my own app classes.
The way I first tought was to create a component, for example CustomDataGrid, like this:
import React from 'react';
import {DataGrid} from '@mui/x-data-grid';
const CustomDataGrid = (props) => {
return <DataGrid {...props} classes={{root: 'my-root-class'}} />;
};
export default CustomDataGrid;
The problem is that I'm using typescript and I want to maintain the type ability to autocomplete in the IDE.
I also tried to define the type of my component as React.FC< Props>, but take a look at the DataGrid code:
declare const DataGrid: React$1.MemoExoticComponent<React$1.ForwardRefExoticComponent<Omit<Partial<DataGridPropsWithDefaultValues> & DataGridPropsWithComplexDefaultValueBeforeProcessing & DataGridPropsWithoutDefaultValue, DataGridForcedPropsKey> & {
pagination?: true | undefined;
} & React$1.RefAttributes<HTMLDivElement>>>;
I don't know what to fill in the generic arguments to type the props.
Does anyone have an idea of how to do this without losing the autocomplete feature?