Closed
Description
TypeScript Version: 3.2.0-rc
Search Terms:
Overload
Code
import { createStore } from 'redux'
const initialStore: { foo: {} } = { foo: {} }
const store = createStore(x => x, initialStore)
Expected behavior:
The second overload of createStore
should be chosen, as initialStore
is not a StoreEnhancer
but a preloadedState
.
Actual behavior:
The StoreEnhancer
, a function, overload of createStore
is chosen despite initialStore
being absolutely, definitely not a function, causing the type of x
to be incorrectly inferred as {} | undefined
.