Nisha Patel
Problem
I created my project using Nodejs 16 and Nextjs 12, but I wanted to update to Nodejs 18. So I did the steps above:
1- Removed my node_modules
2- Removed my .next folder
3- nvm use 18 on terminal
4- yarn (to install all dependencies)
When I finished, this process, I got an error for every component used in my pages folder, or even on a component inside a component:
It didn't show any error on my project, but it kept showing on vs code.
My package.json is:
Solution
make to two steps:
update version nextjs and typescript
next@^12.3.1
typescript@^4.7.4
last:
and ctrl + shift + p
select typescript version -> 4.9.5
Suggested blogs:
>Fix: Strange compilation error with Typescript and Angular
>What if the property 'X' does not exist on type 'FastifyContext<unknown>'?
>How to get the type of a class property's getter/setter in TypeScript?
>How to assign multiple const variables in a single declaration in TypeScript?
>Type inference with 'as const' IN TypeScript
>Typescript Return argument: Tuple type or passed to rest parameter warning?
>Why Typescript does not allow a union type in an array?
>Narrow SomeType vs SomeType[]
>Create a function that convert a dynamic Json to a formula in Typescript
>How to destroy a custom object within the use Effect hook in TypeScript?
>How to type the values of an object into a spreadsheet in TypeScript?