TypeScript rejects the content you put between a React component's tags
Property 'children' does not exist on type 'IntrinsicAttributes & Props'Short answer
Since the React 18 typings, a component no longer gets a children prop for free from React.FC or React.Component. If your props type does not list children, TypeScript refuses content between the tags. Add children?: React.ReactNode to the props type, or stop passing children to a component that does not render them.
Fix it fast
1Find out which cause you have
Find out which React typings are installed, then list every place the compiler complains. If @types/react is 18 or later, the React 18 typings change applies and the causes below are the places to look.
npm ls @types/react npx tsc --noEmit2Match what you see, then jump to its fix
- 1
The error points at a JSX tag such as <Panel>...</Panel>, and Panel is a function whose props type has no children lineA function component's props type never mentions childrenFix - 2
The component is written as class X extends React.Component<Props> and renders this.props.childrenA class component relied on the implicit children of React.ComponentFix - 3
A component from a UI package, or from your own code, that renders its text from another prop such as label or textThe component does not take children at allFix
- 1
What does the error look like?
Property 'children' does not exist on type 'IntrinsicAttributes & Props'The same code compiled before @types/react or React was upgraded, and no source line changed
Cause 1 of 3
A function component's props type never mentions children
1Check
Typings older than 18 added children to every component typed through React.FunctionComponent (React.FC). The new ones do not, so a component that used the free prop must now say so itself. Search for components typed that way.
grep -rnE 'React\.FC|FunctionComponent' src/2Fix
List children in the props type. Use React.ReactNode so text, numbers, elements and arrays are all accepted; drop the question mark if the component is useless without content.
interface PanelProps {
title: string;
children?: React.ReactNode;
}
function Panel({ title, children }: PanelProps) {
return (
<section>
<h2>{title}</h2>
{children}
</section>
);
}3Verify
Run the compiler again and expect no output for that tag.
npx tsc --noEmitConfirmed by react.dev
Cause 2 of 3
A class component relied on the implicit children of React.Component
1Check
The typings change covered class components as well as function components: anything that used the implicit declaration now has to declare children. Look for classes that read this.props.children.
grep -rnE 'this\.props\.children' src/2Fix
Add children to the interface you pass as the first type argument.
interface CardProps {
children?: React.ReactNode;
}
class Card extends React.Component<CardProps> {
render() {
return <div className="card">{this.props.children}</div>;
}
}3Verify
The class tag type-checks with content between its tags.
npx tsc --noEmitConfirmed by github.com
Cause 3 of 3
The component does not take children at all
1Check
TypeScript turns whatever sits between the tags into the children property of the props object. If the props type has no such property, there is nowhere to put it. Read the component's props type and see which prop carries the content.
grep -n 'children' node_modules/my-ui-lib/dist/index.d.ts2Fix
Pass the content through the prop the component does have, instead of between the tags.
// rejected: Badge declares label, not children
<Badge>New</Badge>
// accepted
<Badge label="New" />3Verify
The compiler accepts the usage, and the badge shows the text on screen.
npx tsc --noEmitConfirmed by typescriptlang.org
How do I stop it coming back?
- Declare children in the props of every component that renders it, and type it as React.ReactNode unless you really want exactly one element.
- Keep @types/react and @types/react-dom updated together with React; the React 18 upgrade guide asks for both.
- Run tsc --noEmit in your build pipeline so a typings upgrade fails there with the full list of broken components.
- Before a big React upgrade, read the TypeScript section of its upgrade guide, which links the types-react-codemod migration tool; the React 19 guide links it again for its own type changes.
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: property does not exist on type IntrinsicAttributes in a React component
Object literal may only specify known properties
TypeScript checks the props you write in JSX against the component's props type.
3 causes, each with a fixWeb apps
TypeScript says property children is missing in type when you render a React component
Property 'children' is missing in type
TypeScript is telling you the component's props type lists children as required, and this call site gives none.
2 causes, each with a fixWeb apps
TypeScript 7031 on a destructured children prop in React
Binding element 'children' implicitly has an 'any' type.ts(7031)
With noImplicitAny on, TypeScript refuses to guess a type it cannot infer.
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
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
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 fix