From 819546fdacefe7912d6274bb5d9587e570659870 Mon Sep 17 00:00:00 2001 From: Aziz Khambati Date: Tue, 12 Mar 2019 00:11:04 +0530 Subject: [PATCH 1/5] [redux-batched-subscribe] Update redux version --- types/redux-batched-subscribe/index.d.ts | 9 +++++++-- types/redux-batched-subscribe/package.json | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/types/redux-batched-subscribe/index.d.ts b/types/redux-batched-subscribe/index.d.ts index e3f5345591..30d75759d1 100644 --- a/types/redux-batched-subscribe/index.d.ts +++ b/types/redux-batched-subscribe/index.d.ts @@ -1,11 +1,16 @@ // 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 -import { GenericStoreEnhancer } from 'redux'; +import { StoreEnhancer } from "redux"; export type NotifyFunction = () => void; export type BatchFunction = (notify: NotifyFunction) => void; -export function batchedSubscribe(batch: BatchFunction): GenericStoreEnhancer; +export interface StoreExtension { + subscribeImmediate: () => void; +} + +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" } } From d11cb50ef1e5ea929f9beb80700c0ded58612f90 Mon Sep 17 00:00:00 2001 From: Aziz Khambati Date: Tue, 12 Mar 2019 11:22:29 +0530 Subject: [PATCH 2/5] Add subscribeImmediate tests --- types/redux-batched-subscribe/index.d.ts | 8 ++++---- .../redux-batched-subscribe-tests.ts | 8 +++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/types/redux-batched-subscribe/index.d.ts b/types/redux-batched-subscribe/index.d.ts index 30d75759d1..3cf9f68721 100644 --- a/types/redux-batched-subscribe/index.d.ts +++ b/types/redux-batched-subscribe/index.d.ts @@ -4,13 +4,13 @@ // Aziz Khambati // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import { StoreEnhancer } from "redux"; +import { Store, StoreEnhancer, Action, AnyAction } from "redux"; export type NotifyFunction = () => void; export type BatchFunction = (notify: NotifyFunction) => void; -export interface StoreExtension { - subscribeImmediate: () => void; +export interface StoreExtension { + subscribeImmediate: Store["subscribe"]; } -export function batchedSubscribe(batch: BatchFunction): StoreEnhancer; +export function batchedSubscribe(batch: BatchFunction): StoreEnhancer>; 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(); From 503f0a5aafc8b842c190c93354527a7a763235b9 Mon Sep 17 00:00:00 2001 From: Aziz Khambati Date: Tue, 12 Mar 2019 11:36:26 +0530 Subject: [PATCH 3/5] Remove Generics --- types/redux-batched-subscribe/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/redux-batched-subscribe/index.d.ts b/types/redux-batched-subscribe/index.d.ts index 3cf9f68721..78d7a385bf 100644 --- a/types/redux-batched-subscribe/index.d.ts +++ b/types/redux-batched-subscribe/index.d.ts @@ -9,8 +9,8 @@ import { Store, StoreEnhancer, Action, AnyAction } from "redux"; export type NotifyFunction = () => void; export type BatchFunction = (notify: NotifyFunction) => void; -export interface StoreExtension { - subscribeImmediate: Store["subscribe"]; +export interface StoreExtension { + subscribeImmediate: Store["subscribe"]; } -export function batchedSubscribe(batch: BatchFunction): StoreEnhancer>; +export function batchedSubscribe(batch: BatchFunction): StoreEnhancer; From ce22cdd27c42d0f4bc4de4fa82fe608d7d46c7b5 Mon Sep 17 00:00:00 2001 From: Aziz Khambati Date: Tue, 12 Mar 2019 11:42:47 +0530 Subject: [PATCH 4/5] Add Typescript Version --- types/redux-batched-subscribe/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/redux-batched-subscribe/index.d.ts b/types/redux-batched-subscribe/index.d.ts index 78d7a385bf..b892fbbf90 100644 --- a/types/redux-batched-subscribe/index.d.ts +++ b/types/redux-batched-subscribe/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Dibyo Majumdar // Aziz Khambati // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import { Store, StoreEnhancer, Action, AnyAction } from "redux"; From 11312712a8cc005d4a04b4afd5eade8839fc35e0 Mon Sep 17 00:00:00 2001 From: Aziz Khambati Date: Tue, 12 Mar 2019 11:52:48 +0530 Subject: [PATCH 5/5] Remove imports --- types/redux-batched-subscribe/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/redux-batched-subscribe/index.d.ts b/types/redux-batched-subscribe/index.d.ts index b892fbbf90..aacb421eda 100644 --- a/types/redux-batched-subscribe/index.d.ts +++ b/types/redux-batched-subscribe/index.d.ts @@ -5,7 +5,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -import { Store, StoreEnhancer, Action, AnyAction } from "redux"; +import { Store, StoreEnhancer } from 'redux'; export type NotifyFunction = () => void; export type BatchFunction = (notify: NotifyFunction) => void;