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

Wrong parameter name React.useCallback typescript #42

Open
ghost opened this issue Mar 11, 2021 · 1 comment
Open

Wrong parameter name React.useCallback typescript #42

ghost opened this issue Mar 11, 2021 · 1 comment

Comments

@ghost
Copy link

ghost commented Mar 11, 2021

This parameter name should only be "callback" instead it's shown the TypeScript typings of the function.

Screen Shot 2021-03-11 at 09 35 57

This is React.useCallback TypeScript declaration:

function useCallback<T extends (...args: any[]) => any>(callback: T, deps: DependencyList): T;
@ghost
Copy link
Author

ghost commented Mar 11, 2021

A similar issue with React.memo first parameter:

Screen Shot 2021-03-11 at 10 47 57

TypeScript declaration:

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>;

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

0 participants