Closed mshivam019 closed 10 months ago
I'm seeing the same issue. Even if I strip away the details from VerticalTimelineElement
so it's like this:
`
I still see the error
Type 'Element' is not assignable to type 'ReactNode'.`
Hello guys,
I have faced the same issue once I converted from js into ts. I have fixed that linting error (because code is working fine even with that type error) by creating fresh next js project. Remember to use next version lower than 13.5
Hi @mshivam019 @personnamedmike
I have figured out where this error comes from. It is because of packages you are using. It is probably just @types libraries, but here you have my packages that shows no errors while using experimental features and stephane component.
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "18.2.7",
"react": "^18",
"react-dom": "^18",
"next": "13.4.19",
"typescript": "^5",
I already have these types in my package.json and I am using next version 13.4.13, still facing the same issue @Nlferu
Hi @mshivam019
Are you sure you have same versions even in your lockfile? For example yarn.lock
?
Below you can see my whole package.json and it is working perfectly fine for my project:
"dependencies": {
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "18.2.7",
"@react-email/components": "^0.0.7",
"@react-email/tailwind": "^0.0.8",
"react": "^18",
"react-dom": "^18",
"next": "13.4.19",
"typescript": "^5",
"autoprefixer": "^10",
"postcss": "^8",
"tailwindcss": "^3",
"eslint": "^8",
"eslint-config-next": "13.4.19",
"clsx": "^1.2.1",
"framer-motion": "^10.16.4",
"react-icons": "^4.10.1",
"react-typed": "^1.2.0",
"react-hot-toast": "^2.4.1",
"react-intersection-observer": "^9.5.2",
"react-tsparticles": "^2.9.3",
"react-vertical-timeline-component": "^3.6.0",
"resend": "^0.16.0",
"tsparticles": "^2.9.3"
},
"devDependencies": {
"@types/react-vertical-timeline-component": "^3.3.4"
}
I ended up using this in my typescript project, However I did try this component in my another js project and it was working without any issues.
@mshivam019
Nice, it looks almost the same and it is supporting higher next versions
fixed by upgrading to "@types/react": "18.2.28",
What am i doing wrong
the error i am getting is:
No overload matches this call. Overload 1 of 2, '(props: VerticalTimelineProps | Readonly): VerticalTimeline', gave the following error.
Type 'Element[]' is not assignable to type 'ReactNode'.
Type 'Element[]' is not assignable to type 'Iterable'.
The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types.
Type 'IteratorResult<Element, any>' is not assignable to type 'IteratorResult<ReactNode, any>'.
Type 'IteratorYieldResult' is not assignable to type 'IteratorResult<ReactNode, any>'.
Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'.
Type 'Element' is not assignable to type 'ReactNode'.
Property 'children' is missing in type 'Element' but required in type 'ReactPortal'.
Overload 2 of 2, '(props: VerticalTimelineProps, context: any): VerticalTimeline', gave the following error.
Type 'Element[]' is not assignable to type 'ReactNode'.ts(2769)
index.d.ts(207, 9): 'children' is declared here.
index.d.ts(12, 5): The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly'
index.d.ts(12, 5): The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly'
(parameter) experience: Experiences