Skip to content

Instantly share code, notes, and snippets.

@rickyalmeidadev
Created January 9, 2022 06:56
Show Gist options
  • Save rickyalmeidadev/b72c0bbdf3e795377a660b72765e19bb to your computer and use it in GitHub Desktop.
Save rickyalmeidadev/b72c0bbdf3e795377a660b72765e19bb to your computer and use it in GitHub Desktop.
Override useSelector type definition to recognize your application's state
import type { RootState } from '@app/store';
declare module 'react-redux' {
export function useSelector<TState = RootState, TSelected = unknown>(
selector: (state: TState) => TSelected,
equalityFn?: (left: TSelected, right: TSelected) => boolean,
): TSelected;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment