Skip to content

Commit c3a354a

Browse files
authored
Merge pull request #7770 from marmelab/issue7702
[Typescript] Fix `FunctionField` generic typing restriction
2 parents c0d3aa9 + 913d40d commit c3a354a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

packages/ra-ui-materialui/src/field/FunctionField.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import { useMemo } from 'react';
3-
import { RaRecord, useRecordContext } from 'ra-core';
3+
import { useRecordContext } from 'ra-core';
44
import PropTypes from 'prop-types';
55
import Typography, { TypographyProps } from '@mui/material/Typography';
66

@@ -17,7 +17,8 @@ import { PublicFieldProps, InjectedFieldProps, fieldPropTypes } from './types';
1717
* render={record => record && `${record.first_name} ${record.last_name}`}
1818
* />
1919
*/
20-
export const FunctionField = <RecordType extends RaRecord = any>(
20+
21+
export const FunctionField = <RecordType extends unknown = any>(
2122
props: FunctionFieldProps<RecordType>
2223
) => {
2324
const { className, source = '', render, ...rest } = props;
@@ -45,7 +46,7 @@ FunctionField.propTypes = {
4546
render: PropTypes.func.isRequired,
4647
};
4748

48-
export interface FunctionFieldProps<RecordType extends RaRecord = any>
49+
export interface FunctionFieldProps<RecordType extends unknown = any>
4950
extends PublicFieldProps,
5051
InjectedFieldProps<RecordType>,
5152
Omit<TypographyProps, 'textAlign'> {

packages/ra-ui-materialui/src/field/types.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ export interface PublicFieldProps {
2525
fullWidth?: boolean;
2626
}
2727

28-
// Props injected by react-admin
29-
export interface InjectedFieldProps<RecordType extends RaRecord = any> {
28+
export interface InjectedFieldProps<RecordType = any> {
3029
record?: RecordType;
3130
resource?: string;
3231
}

0 commit comments

Comments
 (0)