Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Next.js and React

TypeScript refuses an array of JSX where one element is expected

ErrorType 'Element[]' is missing the following properties from type 'Element': type, props, key

Short answer

A map() call gives you an array of JSX elements, and an array is not a single Element. The error appears where something is typed to hold exactly one Element: a prop typed ReactElement, a variable or return type typed JSX.Element. Wrap the array in a parent element or a Fragment, or widen the type to React.ReactNode.

  • Applies to TypeScript 5.5, React 19, @types/react 19
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Open the line the error points at. Find the annotation on the receiving side: a prop type, a variable type or a function return type.

    npx tsc --noEmit
  2. 2Match what you see, then jump to its fix

    1. 1The error sits on a JSX attribute, such as children or content, next to a map() callA prop is typed as one element but receives a mapped listFix
    2. 2const rows: JSX.Element = items.map(...)A variable or return type says one element, the value is a listFix

What does the error look like?

  • Type 'Element[]' is missing the following properties from type 'Element': type, props, key

Cause 1 of 2

A prop is typed as one element but receives a mapped list

1Check

React.ReactElement accepts JSX elements only. React.ReactNode is the union of everything that can be passed as children, arrays included.

grep -rn "ReactElement\|JSX.Element" src --include=*.tsx

2Fix

Change the prop to React.ReactNode when a list is a valid value.

interface PanelProps {
  title: string;
  children: React.ReactNode;   // was React.ReactElement
}

3Verify

Run the compiler again.

npx tsc --noEmit

Confirmed by react.dev

Did this fix it?

Cause 2 of 2

A variable or return type says one element, the value is a list

1Check

map() returns a new array of JSX nodes. An array type is written Type[], and it is not the same type as the element it holds.

grep -rn "JSX.Element =" src

2Fix

Give the array its own type, or place it inside one parent element in the output.

const rows = items.map(item => <li key={item.id}>{item.name}</li>);
return <ul>{rows}</ul>;

3Verify

The error is gone and the list renders.

npx tsc --noEmit

Confirmed by react.dev

Did this fix it?

How do I stop it coming back?

  • Type children as React.ReactNode, and use React.ReactElement only when one JSX element is truly required.
  • Give every JSX element in a map() a stable key from your data.
  • Wrap a mapped list in a parent such as <ul>, as the React docs do.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Web apps

TypeScript rejects MUI Data Grid columns that set a type

A TypeScript error inside a column's renderCell callback

A columns array declared without a type is inferred with type as a plain string, which the Data Grid's column type union does not accept.

2 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.