StoreObject
See source codeA store or an object containing a store. This type is used for APIs that can accept either a store directly or an object with a store property.
type StoreObject<R extends UnknownRecord> =
| {
store: Store<R>
}
| Store<R>
Example
function useStore(storeOrObject: StoreObject<MyRecord>) {
const store =
storeOrObject instanceof Store ? storeOrObject : storeOrObject.store
return store
}
Prev
StoreListenerNext
StoreObjectRecordType