Having trouble converting the example app to typescript #280
Unanswered
alexkibler
asked this question in
Q&A
Replies: 1 comment
-
If you pass in the Type to
Hope that makes sense! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello there! I'm working on a new app, starting from using the example app to get authentication set up.
I cloned the folder, set up all the firebase stuff, got everything working both locally and in vercel.
Now I'm working on converting everything to use typescript before I start ripping out components and building my own. However, when I tried converting the
ssr-auth-required.js
component to a.tsx
file, I got a few errors. The first were that it didn't like that thefavoriteColor
prop was untyped. So I created a new interface called Props, typed it, and typed the function component asFC<Props>
(based on this stackoverflow response.However, now at the very bottom of the file where we call withAuthUser with the component, it's saying
Argument of type 'FC<Props>' is not assignable to parameter of type 'ComponentType<unknown>'. Type 'FunctionComponent<Props>' is not assignable to type 'FunctionComponent<unknown>'.
Here's the whole file. The only things I changed from the example are the things I mentioned above, plus I changed
Demo
toGameTracker
It's probably worth mentioning that I'm an angular developer of 6 years and this is my first attempt at learning to do React development.
The weird thing is, if I don't type the props and just make
GameTracker<FC<any>>
, the error goes away. But for curiosity's sake, is it possible to fix this with typed props? Eventually my props will get relatively complicated, so I'd like to type them if I can (but obviously this isn't a blocker for now)Beta Was this translation helpful? Give feedback.
All reactions