-
Robert Knight authored
Extract the `initialState` property out of the `config` object passed to `createStoreModule` into a separate argument which is passed before `config`. This allows TypeScript to infer the type of fields/parameters etc. which refer to the module state while processing the `config` argument. For example, given the following: ``` export default createStoreModule(initialState, { reducers: { updateThing(state, action) { ... } } }); ``` TS can infer the type of the `state` argument to `updateThing` without needing to explicitly annotate it. The same approach can work for other fields as well. This inference does not work when `initialState` is a property of the `config` object however.
a1183565
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
modules | ||
test | ||
create-store.js | ||
debug-middleware.js | ||
index.js | ||
use-store.js | ||
util.js |