Skip to content

Commit 5e1eaef

Browse files
committed
add NoInfer to Ext return
1 parent 642a756 commit 5e1eaef

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/createStore.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import ActionTypes from './utils/actionTypes'
1414
import isPlainObject from './utils/isPlainObject'
1515
import { kindOf } from './utils/kindOf'
1616

17+
type NoInfer<T> = [T][T extends any ? 0 : never]
18+
1719
/**
1820
* @deprecated
1921
*
@@ -47,7 +49,7 @@ export function createStore<
4749
>(
4850
reducer: Reducer<S, A>,
4951
enhancer?: StoreEnhancer<Ext, StateExt>
50-
): Store<S, A, UnknownIfNonSpecific<StateExt>> & Ext
52+
): Store<S, A, UnknownIfNonSpecific<StateExt>> & NoInfer<Ext>
5153
/**
5254
* @deprecated
5355
*
@@ -83,7 +85,7 @@ export function createStore<
8385
reducer: Reducer<S, A, PreloadedState>,
8486
preloadedState?: PreloadedState | undefined,
8587
enhancer?: StoreEnhancer<Ext, StateExt>
86-
): Store<S, A, UnknownIfNonSpecific<StateExt>> & Ext
88+
): Store<S, A, UnknownIfNonSpecific<StateExt>> & NoInfer<Ext>
8789
export function createStore<
8890
S,
8991
A extends Action,
@@ -94,7 +96,7 @@ export function createStore<
9496
reducer: Reducer<S, A, PreloadedState>,
9597
preloadedState?: PreloadedState | StoreEnhancer<Ext, StateExt> | undefined,
9698
enhancer?: StoreEnhancer<Ext, StateExt>
97-
): Store<S, A, UnknownIfNonSpecific<StateExt>> & Ext {
99+
): Store<S, A, UnknownIfNonSpecific<StateExt>> & NoInfer<Ext> {
98100
if (typeof reducer !== 'function') {
99101
throw new Error(
100102
`Expected the root reducer to be a function. Instead, received: '${kindOf(

0 commit comments

Comments
 (0)