diff --git a/definitions/npm/@reduxjs/toolkit_v1.x.x/flow_v0.104.x-/test_toolkit_v1.x.x.js b/definitions/npm/@reduxjs/toolkit_v1.x.x/flow_v0.104.x-/test_toolkit_v1.x.x.js index e1f62e2750..8635bf11f8 100644 --- a/definitions/npm/@reduxjs/toolkit_v1.x.x/flow_v0.104.x-/test_toolkit_v1.x.x.js +++ b/definitions/npm/@reduxjs/toolkit_v1.x.x/flow_v0.104.x-/test_toolkit_v1.x.x.js @@ -5,6 +5,8 @@ import { createReducer, configureStore, type Middleware, + type Store, + type Action, } from '@reduxjs/toolkit'; describe('@redux/toolkit', () => { @@ -63,6 +65,41 @@ describe('@redux/toolkit', () => { configureStore({ reducer, }); + + const store: Store<{ + test: { ... }, + test2: number, + ... + }, Action<{ ... }>> = configureStore({ + reducer: { + test: (a) => ({}), + test2: (a) => 2, + }, + }); + + const failedStore: Store<{| + test: { ... }, + test2: number, + // $FlowExpectedError[prop-missing] foo is missing + |}, Action<{ ... }>> = configureStore({ + reducer: { + test: (a) => ({}), + test2: (a) => 2, + foo: () => 'bar', + }, + }); + + // const failedStore2: Store<{ + // test: { ... }, + // // Expect this to fail but currently does not + // test2: string, + // ... + // }, Action<{ ... }>> = configureStore({ + // reducer: { + // test: (a) => ({}), + // test2: (a) => 2, + // }, + // }); }); test('full example', () => { diff --git a/definitions/npm/@reduxjs/toolkit_v1.x.x/flow_v0.104.x-/toolkit_v1.x.x.js b/definitions/npm/@reduxjs/toolkit_v1.x.x/flow_v0.104.x-/toolkit_v1.x.x.js index b3748382a9..c7b4794196 100644 --- a/definitions/npm/@reduxjs/toolkit_v1.x.x/flow_v0.104.x-/toolkit_v1.x.x.js +++ b/definitions/npm/@reduxjs/toolkit_v1.x.x/flow_v0.104.x-/toolkit_v1.x.x.js @@ -49,7 +49,7 @@ declare module '@reduxjs/toolkit' { // -------------------- - declare type Middlewares = $ReadOnlyArray>; + declare type Middlewares = $ReadOnlyArray>; declare type DevToolsOptions = {| /** @@ -423,6 +423,8 @@ declare module '@reduxjs/toolkit' { */ declare type ConfigureEnhancersCallback = (defaultEnhancers: $ReadOnlyArray>) => Array>; + declare type ReducersMapObject = (V) => Reducer>; + /** * Options for `configureStore()`. */ @@ -431,10 +433,7 @@ declare module '@reduxjs/toolkit' { * A single reducer function that will be used as the root reducer, or an * object of slice reducers that will be passed to `combineReducers()`. */ - reducer: Reducer | { - [key: string]: Reducer, - ... - }, + reducer: Reducer | $ObjMap, /** * An array of Redux middleware to install. If not supplied, defaults to * the set of middleware returned by `getDefaultMiddleware()`.