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

Missing memo overload for MemoExoticComponent #505

Closed
steinybot opened this issue Sep 7, 2021 · 0 comments · Fixed by #530
Closed

Missing memo overload for MemoExoticComponent #505

steinybot opened this issue Sep 7, 2021 · 0 comments · Fixed by #530
Labels
Milestone

Comments

@steinybot
Copy link
Contributor

In the TS definitions there are 2 overloads for React.memo:

    function memo<P extends object>(
        Component: SFC<P>,
        propsAreEqual?: (prevProps: Readonly<PropsWithChildren<P>>, nextProps: Readonly<PropsWithChildren<P>>) => boolean
    ): NamedExoticComponent<P>;
    function memo<T extends ComponentType<any>>(
        Component: T,
        propsAreEqual?: (prevProps: Readonly<ComponentProps<T>>, nextProps: Readonly<ComponentProps<T>>) => boolean
    ): MemoExoticComponent<T>;

Slinky has the first one (covered by 2 overloads because of the optional propsAreEqual parameter) but not the second.

The one with MemoExoticComponent is important because it will pull out the props from the component otherwise you end up with a component taking another component.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants