-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug
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
.
Metadata
Metadata
Assignees
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug