From 5290758276b530309a8917439b8c560c94363b16 Mon Sep 17 00:00:00 2001 From: Gavin Gregory Date: Wed, 21 Jun 2017 16:58:01 -0400 Subject: [PATCH] fix definitions for 'redux-immutable'. 'redux-immutable' combineReducers() accepts an optional second parameter which was not accounted for in the definitions. --- types/redux-immutable/index.d.ts | 10 ++++++--- types/redux-immutable/package.json | 3 ++- .../redux-immutable/redux-immutable-tests.ts | 21 +++++++++++++++++-- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/types/redux-immutable/index.d.ts b/types/redux-immutable/index.d.ts index 483de7c9bf..ebebd7a84c 100644 --- a/types/redux-immutable/index.d.ts +++ b/types/redux-immutable/index.d.ts @@ -1,8 +1,12 @@ -// Type definitions for redux-immutable v3.0.10 +// Type definitions for redux-immutable v3.0.33 // Project: https://github.com/gajus/redux-immutable -// Definitions by: Pedro Pereira , Sebastian Sebald +// Definitions by: Pedro Pereira +// Sebastian Sebald +// Gavin Gregory // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import * as Redux from 'redux'; +import { Collection } from 'immutable'; -export declare function combineReducers(reducers: Redux.ReducersMapObject): Redux.Reducer; +export declare function combineReducers(reducers: Redux.ReducersMapObject, getDefaultState?: () => Collection.Keyed): Redux.Reducer; +export declare function combineReducers(reducers: Redux.ReducersMapObject, getDefaultState?: () => Collection.Indexed): Redux.Reducer; diff --git a/types/redux-immutable/package.json b/types/redux-immutable/package.json index e52256ea90..be19181dda 100644 --- a/types/redux-immutable/package.json +++ b/types/redux-immutable/package.json @@ -1,5 +1,6 @@ { "dependencies": { - "redux": "^3.6.0" + "redux": "^3.6.0", + "immutable": "^3.8.1" } } \ No newline at end of file diff --git a/types/redux-immutable/redux-immutable-tests.ts b/types/redux-immutable/redux-immutable-tests.ts index 8414252299..c790ce545e 100644 --- a/types/redux-immutable/redux-immutable-tests.ts +++ b/types/redux-immutable/redux-immutable-tests.ts @@ -1,5 +1,22 @@ import { combineReducers } from 'redux-immutable'; +import { Map, List } from 'immutable'; -combineReducers({ -}); \ No newline at end of file +// Dummy State interface +interface State { }; + +/** + * Combine reducers should work with only one argument (a reducers object). + */ +combineReducers({}); +combineReducers({}); + +/** + * Combine reducers should accepts a function (getDefaultState()) as a second parameter, that returns an immutable Collection.Keyed collection. + */ +combineReducers({}, () => { return Map(); }); +combineReducers({}, () => { return Map(); }); +/** + * Combine reducers should accepts a function (getDefaultState()) as a second parameter, that returns an immutable Collection.Indexed collection. + */ +combineReducers({}, () => { return List(); });