I am using ag-grid with typescript and React
OnGridReady event params throws an error
import { AgGridEvent, ICellRendererParams, ModuleRegistry } from "@ag-grid-community/core";
const onGridReady = (params: AgGridEvent): void => {
setGridApi(params.api);
params.api.sizeColumnsToFit();
};
When I build it throws an error
Type error: No overload matches this call.
Overload 1 of 2, '(props: Readonly<AgGridReactProps>): AgGridReact', gave the following error.
Type '(params: AgGridEvent) => void' is not assignable to type '(event: GridReadyEvent) => void'.
Types of parameters 'params' and 'event' are incompatible.
Type 'GridReadyEvent' is not assignable to type 'AgGridEvent'.
Types of property 'api' are incompatible.
Type 'import("/Users/subha/admin/admin_demo/node_modules/ag-grid-community/dist/lib/gridApi").GridApi' is not assignable to type 'import("/Users/subha/admin/admin_demo/node_modules/@ag-grid-community/core/dist/cjs/gridApi").GridApi'.
Types have separate declarations of a private property 'immutableService'.
Overload 2 of 2, '(props: AgGridReactProps, context?: any): AgGridReact', gave the following error.
Type '(params: AgGridEvent) => void' is not assignable to type '(event: GridReadyEvent) => void'.
104 | suppressCellSelection={true}
105 | frameworkComponents={{ editRenderer }}
> 106 | onGridReady={onGridReady}
| ^
107 | ></AgGridReact>
108 | </div>
109 | </div>
info - Creating an optimized production build .npm ERR! code ELIFECYCLE**