Skip to content

Commit 3b06061

Browse files
phryneasmarkerikson
authored andcommitted
wrap type in
1 parent ad40b97 commit 3b06061

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/hooks/useSelector.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useContext, useDebugValue } from 'react'
22

33
import { useReduxContext as useDefaultReduxContext } from './useReduxContext'
44
import { ReactReduxContext } from '../components/Context'
5-
import type { EqualityFn } from '../types'
5+
import type { EqualityFn, NoInfer } from '../types'
66
import type { uSESWS } from '../utils/useSyncExternalStore'
77
import { notInitialized } from '../utils/useSyncExternalStore'
88

@@ -32,7 +32,7 @@ export function createSelectorHook(
3232

3333
return function useSelector<TState, Selected extends unknown>(
3434
selector: (state: TState) => Selected,
35-
equalityFn: EqualityFn<Selected> = refEquality
35+
equalityFn: EqualityFn<NoInfer<Selected>> = refEquality
3636
): Selected {
3737
if (process.env.NODE_ENV !== 'production') {
3838
if (!selector) {

src/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,5 @@ export interface TypedUseSelectorHook<TState> {
168168
equalityFn?: EqualityFn<TSelected>
169169
): TSelected
170170
}
171+
172+
export type NoInfer<T> = [T][T extends any ? 0 : never]

0 commit comments

Comments
 (0)