Skip to content

Typescript compilation errors on 5.14.5 with ArrayField #11232

@dolfinus

Description

@dolfinus

What you were expecting:
I'm using an ArrayField component:
https://github.com/MTSWebServices/data-rentgen-ui/blob/099f72030c2ba108f05a3312060eddc8b24a2c09/src/components/dataset/DatasetRaList.tsx

<List resource="datasets">
    <DatagridConfigurable bulkActionButtons={false}>
        <TextField
            source="data.name"
            label="resources.datasets.fields.name"
            sortable={false}
        />
        <ArrayField
            source="data.tags"
            label="resources.datasets.fields.tags"
        >
            <SomeComponent />
        </ArrayField>
    </DatagridConfigurable>
</List>

It compiled properly on 5.14.4, but started to fail after upgrading to 5.14.5

What happened instead:
https://github.com/MTSWebServices/data-rentgen-ui/actions/runs/24035103336/job/70092613450?pr=152

Error: src/components/dataset/DatasetRaList.tsx(40,21): error TS2322: Type '{ children: Element; source: "data.tags"; label: string; }' is not assignable to type 'IntrinsicAttributes & ArrayFieldBaseProps<{ "data.tags": any; } & { data: any; } & { "data.tags": any; } & { "data.tags": any; } & { "data.tags": any; } & { data: any; }>'.
  Property 'label' does not exist on type 'IntrinsicAttributes & ArrayFieldBaseProps<{ "data.tags": any; } & { data: any; } & { "data.tags": any; } & { "data.tags": any; } & { "data.tags": any; } & { data: any; }>'.

This is because #11191 switched from:

const ArrayFieldImpl(props: ArrayFieldProps) => { ... };

export const ArrayField = genericMemo(ArrayFieldeImpl);
export interface ArrayFieldProps extends FieldProps;

to

const ArrayFieldBaseImpl(props: ArrayFieldBaseProps) => { ... };

export const ArrayFieldBase = genericMemo(ArrayFieldeBaseImpl);
export interface ArrayFieldBaseProps extends FieldBaseProps;

export const ArrayField = ArrayFieldBase;

FieldProps do have label property, but FieldBaseProps doesn't.

Steps to reproduce:

Related code:

insert short code snippets here

Other information:

Environment

  • React-admin version: 5.14.5
  • Last version that did not exhibit the issue (if applicable): 5.14.4
  • React version: 19.2.4
  • Browser: NodeJS
  • Stack trace (in case of a JS error): see above

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions