Buuntu / fastapi-react

🚀 Cookiecutter Template for FastAPI + React Projects. Using PostgreSQL, SQLAlchemy, and Docker
MIT License
2.19k stars 349 forks source link

'unknown' is not assignable to parameter of type 'SetStateAction<string>'. #168

Open treize06 opened 3 years ago

treize06 commented 3 years ago

When launching docker compose up and then going to localhost:8000, I got the following error:

/app/src/views/Login.tsx TypeScript error in /app/src/views/Login.tsx(54,18): Argument of type 'unknown' is not assignable to parameter of type 'SetStateAction'. Type 'unknown' is not assignable to type '(prevState: string) => string'. TS2345

52 |       } else {
53 |         // handle errors thrown from backend

54 | setError(err); | ^ 55 | } 56 | } 57 | };

rxnel commented 3 years ago

first time using TS so I thought it was just me -- am getting the same error

felixthebeard commented 3 years ago

You can try changing the strict setting in frontend/tsconfig.json to false.

treize06 commented 3 years ago

thanks its working now

JosXa commented 3 years ago
      } else {
        // handle errors thrown from backend
        setError(String(err));
      }

Cast does the trick

Buuntu commented 2 years ago

I'll merge a PR if you want to make one for this?