Today I switched my yarn version from 1.x to 3.x (latest) and I started having issues with the Typescript on my project.
I've seen many people having this same issue but unfortunately none of the solutions provided fixed it.
This is my current package.json version:
{
"name": "project",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"autoprefixer": "10.4.8",
"axios": "0.27.2",
"bcryptjs": "2.4.3",
"dateformat": "5.0.3",
"next": "12.2.4",
"next-auth": "4.10.3",
"next-cookie": "2.8.0",
"next-seo": "5.5.0",
"postcss": "8.4.16",
"qs": "6.11.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-icons": "4.4.0",
"sass": "1.54.4",
"sharp": "0.30.7",
"swr": "1.3.0",
"tslib": "2.4.0",
"web-vitals": "2.1.4"
},
"devDependencies": {
"@types/bcryptjs": "2.4.2",
"@types/node": "18.7.14",
"@types/qs": "6.9.7",
"@types/react": "18.0.18",
"@types/react-dom": "18.0.6",
"eslint": "8.21.0",
"eslint-config-next": "12.2.4",
"typescript": "4.7.4"
},
"peerDependencies": {
"react-scripts": "4.0.0"
}
}
Even adding @types/react to devDependencies I still get the error. I've also tried to restart the Vscode (and the computer), deleting .yarn-lock, deleting the directory .yarn (I don't get node_modules anymore). No luck.
It also looks like Typescript is trying to find the types for every package I'm using but some of them don't have it, then through errors about them too.
It used to work well before this Yarn migration.
Does anyone know how to fix? Thank you!