I have a project structured:
export interface Project{
id: String,
title: String,
description: String,
image?: any,
languages: String[]
}
and when I try to map over the languages array like:
import { useRouter } from 'next/router'
import { useEffect, useState } from 'react'
import Head from 'next/head'
import Image from 'next/image'
import { multipleProjects } from '../../test/projects'
import { Project as ProjectType } from '../../assets/types/types'
export default function Project() {
const router = useRouter()
const { id } = router.query
const [project, setProject] = useState<ProjectType>(null)
useEffect(() => {
const _project = multipleProjects.find(p => p.id === id)
if (_project) setProject(_project)
}, [])
if (!project) return "No project"
return (
<div className="h-screen def-background pt-16">
<Head>
<title>Project: </title>
</Head>
<div className="flex w-8/12 mx-auto mb-auto mt-24 flex-col justify-center items-center text-gray-200 font-mono">
<p className="text-center text-3xl font-bold tracking-wide text-gray-300 mx-4 p-2">{project.title}</p>
<div className="w-full h-72 relative m-8 p-4">
<Image
src={project.image}
alt={`Picture of the ${project.title}`}
layout='fill'
/>
</div>
<div className="w-full mx-12 p-4 text-left text-indent flex-grow">
{project.description}
</div>
{project.languages?.map((language, index) => {
return (
<div key={index} className="self-end flex gap-2 italic mr-8 mt-12 p-2 text-gray-600 text-sm">
{language}
</div>
)
})}
</div>
</div>
)
}
It throws an Excessive stack depth comparing types 'FlatArray<Arr, ?>' and 'FlatArray<Arr, ?>' error. What might be the reason for that?
I ran into this issue which tells me to downgrade VSCode's used TS version, but is there any other solution that someone came up with?