diff --git a/types/redux-batched-subscribe/index.d.ts b/types/redux-batched-subscribe/index.d.ts index e3f5345591..aacb421eda 100644 --- a/types/redux-batched-subscribe/index.d.ts +++ b/types/redux-batched-subscribe/index.d.ts @@ -1,11 +1,17 @@ // Type definitions for redux-batched-subscribe 0.1 // Project: https://github.com/tappleby/redux-batched-subscribe // Definitions by: Dibyo Majumdar +// Aziz Khambati // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 -import { GenericStoreEnhancer } from 'redux'; +import { Store, StoreEnhancer } from 'redux'; export type NotifyFunction = () => void; export type BatchFunction = (notify: NotifyFunction) => void; -export function batchedSubscribe(batch: BatchFunction): GenericStoreEnhancer; +export interface StoreExtension { + subscribeImmediate: Store["subscribe"]; +} + +export function batchedSubscribe(batch: BatchFunction): StoreEnhancer; diff --git a/types/redux-batched-subscribe/package.json b/types/redux-batched-subscribe/package.json index f5b5c699de..7f5b19d45b 100644 --- a/types/redux-batched-subscribe/package.json +++ b/types/redux-batched-subscribe/package.json @@ -1,6 +1,6 @@ { "private": true, "dependencies": { - "redux": ">=1.0.0 <4.0.0" + "redux": "^4.0.0" } } diff --git a/types/redux-batched-subscribe/redux-batched-subscribe-tests.ts b/types/redux-batched-subscribe/redux-batched-subscribe-tests.ts index 6fa3e891b3..d46f8af7d3 100644 --- a/types/redux-batched-subscribe/redux-batched-subscribe-tests.ts +++ b/types/redux-batched-subscribe/redux-batched-subscribe-tests.ts @@ -23,7 +23,13 @@ const asyncNotify: BatchFunction = (() => { }; })(); -const store: Store = createStore( +const store = createStore( rootReducer, batchedSubscribe(asyncNotify) ); + +const unsubscribe = store.subscribeImmediate(() => { + store.getState(); +}); + +unsubscribe();