Prop types are lost when using memo
G07cha opened this issue · comments
I've noticed that with move to typescript while losing memo
from react-tracked props types defined as generics to FC
or VFC
are not being passed through unless they are specified in callback arguments itself. I've tried fixing it myself but wasn't able to unfortunately, hence made this issue.
// Works
const MyComponent = memo(({ foo }: { foo: string }) => {})
// Doesn't, typeof foo is 'any'
const MyComponent: FC<{ foo: string }> = memo(({ foo }) => {})
Here is another example in sandbox:
You can try it out here: https://codesandbox.io/s/friendly-rhodes-n8rm8?file=/src/components/FilterLink.tsx
Accidental duplicate