• Robert Knight's avatar
    Improve type of `selectors` map · 4fd547b3
    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 Loading commit data...
test Loading commit data...
create-store.js Loading commit data...
debug-middleware.js Loading commit data...
index.js Loading commit data...
use-store.js Loading commit data...
util.js Loading commit data...