Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
treize06 opened this issue Sep 1, 2021 · 5 comments

Comments

@treize06
Copy link

treize06 commented Sep 1, 2021

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
Copy link

rxnel commented Sep 1, 2021

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

@felixthebeard
Copy link

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

@treize06
Copy link
Author

treize06 commented Sep 6, 2021

thanks its working now

@JosXa
Copy link
Contributor

JosXa commented Sep 11, 2021

      } else {
        // handle errors thrown from backend
        setError(String(err));
      }

Cast does the trick

@Buuntu
Copy link
Owner

Buuntu commented Sep 21, 2021

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

JosXa added a commit to JosXa/fastapi-react that referenced this issue Sep 21, 2021
cardoe added a commit to cardoe/fastapi-react that referenced this issue Nov 2, 2021
This failed to compile due to a mis-match of types with TypeScript 4.x.
fixes Buuntu#168.
cardoe added a commit to cardoe/fastapi-react that referenced this issue Nov 2, 2021
This failed to compile due to a mis-match of types with TypeScript 4.x.
fixes Buuntu#168.
cardoe added a commit to cardoe/fastapi-react that referenced this issue Nov 2, 2021
This failed to compile due to a mis-match of types with TypeScript 4.x.
fixes Buuntu#168.
Buuntu pushed a commit that referenced this issue Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants