Closed
Description
What you were expecting:
I'm getting this error
Conversion of type 'RecordType' to type 'MyGenericType' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
And I believe it is bad practice to continue with the unkown for this case
What happened instead:
I'm not able to pass a generic to the datagrid so that it changes the record in rowClick and other functions.
- If I try to pass the generic it says it doesn't accept it
- If I don't pass the generic the error in the row function still remains and I can't overwrite it without passing unknow
Steps to reproduce:
- Create any list screen
- Use RowClick and assign a record with "as"
Related code:
Datagrid.tsx / DatagridProps
export interface DatagridProps<RecordType extends RaRecord = any>
extends Omit<TableProps, 'size' | 'classes' | 'onSelect'> {
/**
* The component used to render the body of the table. Defaults to <DatagridBody>.
*
* @see https://marmelab.com/react-admin/Datagrid.html#body
*/
body?: ReactElement | ComponentType;
/**
* A class name to apply to the root table element
*/
className?: string;
Other information:
Environment
- React-admin version: 5.6.3
- Last version that did not exhibit the issue (if applicable): 5.3.4
- React version: 18.3.1
- Browser: Chrome
- Stack trace (in case of a JS error): N/A