-
Robert Knight authored
Improve the type of the `selectors` argument to `createStoreModule` to link it to the type of the initial state returned by the `initialState` argument. This enables TS to check/infer that the first argument to these functions should be of the same type that `initialState` returns. In the process it was necessary to remove the `ModuleConfig` type and declare the type of `createStoreModule`'s `config` argument inline. This works around a TypeScript limitation [1]: ``` @template State @template {SelectorMap<State>} Selectors // Unexpected error ... @typedef ModuleConfig ``` But this works: `` @template State @template {SelectorMap<State>} Selectors // OK ... function createStoreModule(...) { ... } ``` [1] https://github.com/microsoft/TypeScript/issues/43403
4fd547b3
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
modules | ||
test | ||
create-store.js | ||
debug-middleware.js | ||
index.js | ||
use-store.js | ||
util.js |