Skip to content

Commit

Permalink
Match WithRecord types to FunctionField types
Browse files Browse the repository at this point in the history
Matches changes implemented in marmelab#8964
  • Loading branch information
elstgav authored and TurtIeSocks committed Jun 29, 2023
1 parent 6824937 commit f600a32
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/ra-core/src/controller/record/WithRecord.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ import { useRecordContext } from './useRecordContext';
* </Show>
* );
*/
export const WithRecord = <RecordType extends RaRecord>({
export const WithRecord = <RecordType extends Record<string, unknown> = any>({
render,
}: WithRecordProps<RecordType>) => {
const record = useRecordContext<RecordType>();
return record ? render(record) : null;
};

export interface WithRecordProps<RecordType extends RaRecord> {
export interface WithRecordProps<
RecordType extends Record<string, unknown> = any
> {
render: (record: RecordType) => ReactElement;
label?: string;
}

0 comments on commit f600a32

Please sign in to comment.