Skip to content

fix: Restore ArrayField TypeScript type to accept FieldProps (including label prop)#11233

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/fix-typescript-errors-arrayfield
Draft

fix: Restore ArrayField TypeScript type to accept FieldProps (including label prop)#11233
Copilot wants to merge 2 commits intomasterfrom
copilot/fix-typescript-errors-arrayfield

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 6, 2026

Problem

PR #11191 (v5.14.5) changed ArrayField from its own component to a direct re-export of ArrayFieldBase. This dropped FieldProps from the TypeScript signature, breaking any usage of props like label, className, cellClassName, sortable, etc.:

// TS2322: Property 'label' does not exist on type 'ArrayFieldBaseProps'
<ArrayField source="data.tags" label="Tags">
    <SomeComponent />
</ArrayField>

ArrayFieldBaseProps (ra-core) extends BaseFieldProps — no UI metadata props. FieldProps (ra-ui-materialui) adds label, className, cellClassName, sortable, sortBy, textAlign, etc.

Solution

Cast ArrayField to use ArrayFieldProps (which extends both ArrayFieldBaseProps and FieldProps) in ra-ui-materialui:

// Before
export const ArrayField = ArrayFieldBase;

// After
export const ArrayField = ArrayFieldBase as unknown as <
    RecordType extends Record<string, any> = Record<string, any>,
>(props: ArrayFieldProps<RecordType>) => React.ReactElement;

Type-only change — at runtime the extra FieldProps fields are passed through and ignored by ArrayFieldBase (consumed by parent components like Datagrid/SimpleShowLayout that inspect children's props).

How To Test

// Should compile without error
<ArrayField source="tags" label="Tags">
    <SingleFieldList>
        <ChipField source="name" />
    </SingleFieldList>
</ArrayField>

Run packages/ra-ui-materialui unit tests — the spec includes a regression test verifying label prop is accepted.

Additional Checks

  • The PR targets master for a bugfix or a documentation fix, or next for a feature
  • The PR includes unit tests (if not possible, describe why)
  • The PR includes one or several stories (if not possible, describe why) — type-only fix, no visual change
  • The documentation is up to date — no API change

Also, please make sure to read the contributing guidelines.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • download.cypress.io
    • Triggering command: /opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node dist/index.js --exec install (dns block)
  • fake-domain-marmelab.com
    • Triggering command: /opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node /home/REDACTED/work/react-admin/react-admin/node_modules/jest-worker/build/workers/processChild.js (dns block)
  • gravatar.com
    • Triggering command: /opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node /home/REDACTED/work/react-admin/react-admin/node_modules/jest-worker/build/workers/processChild.js (dns block)
  • marmelab.com
    • Triggering command: /opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node /home/REDACTED/work/react-admin/react-admin/node_modules/jest-worker/build/workers/processChild.js (dns block)
  • www.gravatar.com
    • Triggering command: /opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node /home/REDACTED/work/react-admin/react-admin/node_modules/jest-worker/build/workers/processChild.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

…ng label prop)

Agent-Logs-Url: https://github.com/marmelab/react-admin/sessions/09a2d7a3-86fe-49c6-addb-bdcb7bad1a27

Co-authored-by: fzaninotto <99944+fzaninotto@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix TypeScript compilation errors with ArrayField fix: Restore ArrayField TypeScript type to accept FieldProps (including label prop) Apr 6, 2026
Copilot AI requested a review from fzaninotto April 6, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Typescript compilation errors on 5.14.5 with ArrayField

2 participants