TypeScript refuses an array of JSX where one element is expected
Type 'Element[]' is missing the following properties from type 'Element': type, props, keyShort 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.
Fix it fast
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 --noEmit2Match what you see, then jump to its fix
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=*.tsx2Fix
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 --noEmitConfirmed by react.dev
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 =" src2Fix
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 --noEmitConfirmed by react.dev
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:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- TaskvareA task and project-management suite: React on the web, Flutter on mobile, TypeScript underneath.
Related fixes
Web apps
TypeScript rejects a component that returns an array or other non-Element
Its return type 'Element[]' is not a valid JSX element.
TypeScript before 5.1 required every component to return JSX.Element or null, so arrays, strings and Promises were rejected even though React renders them.
2 causes, each with a fixWeb apps
TypeScript refuses JSX because the jsx option is not set
TS17004: Cannot use JSX unless the '--jsx' flag is provided.
TypeScript compiles JSX only when you name the file with a .tsx extension and enable the jsx compiler option.
2 causes, each with a fixWeb apps
ESLint says it cannot resolve a path to a module that does exist
Unable to resolve path to module 'react'. import/no-unresolved
import/no-unresolved fails when eslint-plugin-import cannot find the file or package on disk with its resolver.
4 causes, each with a fixWeb apps
ESLint reports no-unused-vars for React components and imports that are used
no-unused-vars reported for a component that is rendered as a JSX tag
ESLint's core no-unused-vars does not see variables used only as JSX tags, so a component imported and rendered as <Hello /> looks unused.
3 causes, each with a fixWeb 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 fixWeb apps
The renderInput prop stopped working on the MUI X DatePicker
The custom TextField (variant, size, helperText) is ignored
renderInput was removed from the MUI X date pickers in version 6.
3 causes, each with a fix