TypeScript Error when adding children
See original GitHub issueHere’s all that’s going on in my .tsx:
const stuff = [1, 2, 3]
return (
<FlipMove>
{stuff.map((item) => {
return (
<div key={item}>some div</div>
);
})}
</FlipMove>
);
I get the following TS error:
[{
"resource": "xxx.tsx",
"owner": "typescript",
"code": "2769",
"severity": 8,
"message": "No overload matches this call.\n Overload 1 of 2, '(props: FlipMoveProps | Readonly<FlipMoveProps>): FlipMove', gave the following error.\n Type '{ children: Element[]; duration: number; staggerDurationBy: number; staggerDelayBy: number; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<FlipMove> & Readonly<FlipMoveProps>'.\n Property 'children' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<FlipMove> & Readonly<FlipMoveProps>'.\n Overload 2 of 2, '(props: FlipMoveProps, context: any): FlipMove', gave the following error.\n Type '{ children: Element[]; duration: number; staggerDurationBy: number; staggerDelayBy: number; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<FlipMove> & Readonly<FlipMoveProps>'.\n Property 'children' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<FlipMove> & Readonly<FlipMoveProps>'.",
"source": "ts",
"startLineNumber": 41,
"startColumn": 6,
"endLineNumber": 41,
"endColumn": 14
}]
I’m using react-flip-move 3.0.4, which is the latest.
Issue Analytics
- State:
- Created a year ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Typescript error when adding children to Card #3556 - GitHub
I am trying to add children to Card component, but getting a Typescript error. Type '{ children: Element; }' has no properties in...
Read more >React 18 TypeScript children FC - Stack Overflow
This error occurs when you are passing no props to the Component. children prop should be an optional prop. So giving those props...
Read more >property 'children' does not exist on type 'intrinsicattributes
The React.js error "Property 'children' does not exist on type" occurs when we try access the children property in a component for which...
Read more >дэн on Twitter: "If you're getting TypeScript errors about the ...
If you're getting TypeScript errors about the `children` prop when upgrading @types/react to 18.0.0, the fix looks like this.
Read more >How Children Types Work In React 18 And TypeScript 4
Which one should we use for adding types to children in our custom components? When to use ReactNode, ReactElement, or JSX.Element. A common ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

when will this be pushed live?
No idea, I know it got merged, but I’m not sure when the maintainers would want to cut a release. I defer to you, @xcv58!