Skip to content

Commit

Permalink
add NoInfer to Ext return
Browse files Browse the repository at this point in the history
  • Loading branch information
EskiMojo14 committed Jul 9, 2024
1 parent 642a756 commit 5e1eaef
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/createStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import ActionTypes from './utils/actionTypes'
import isPlainObject from './utils/isPlainObject'
import { kindOf } from './utils/kindOf'

type NoInfer<T> = [T][T extends any ? 0 : never]

/**
* @deprecated
*
Expand Down Expand Up @@ -47,7 +49,7 @@ export function createStore<
>(
reducer: Reducer<S, A>,
enhancer?: StoreEnhancer<Ext, StateExt>
): Store<S, A, UnknownIfNonSpecific<StateExt>> & Ext
): Store<S, A, UnknownIfNonSpecific<StateExt>> & NoInfer<Ext>
/**
* @deprecated
*
Expand Down Expand Up @@ -83,7 +85,7 @@ export function createStore<
reducer: Reducer<S, A, PreloadedState>,
preloadedState?: PreloadedState | undefined,
enhancer?: StoreEnhancer<Ext, StateExt>
): Store<S, A, UnknownIfNonSpecific<StateExt>> & Ext
): Store<S, A, UnknownIfNonSpecific<StateExt>> & NoInfer<Ext>
export function createStore<
S,
A extends Action,
Expand All @@ -94,7 +96,7 @@ export function createStore<
reducer: Reducer<S, A, PreloadedState>,
preloadedState?: PreloadedState | StoreEnhancer<Ext, StateExt> | undefined,
enhancer?: StoreEnhancer<Ext, StateExt>
): Store<S, A, UnknownIfNonSpecific<StateExt>> & Ext {
): Store<S, A, UnknownIfNonSpecific<StateExt>> & NoInfer<Ext> {
if (typeof reducer !== 'function') {
throw new Error(
`Expected the root reducer to be a function. Instead, received: '${kindOf(
Expand Down

0 comments on commit 5e1eaef

Please sign in to comment.