• 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
..
annotator Loading commit data...
boot Loading commit data...
images/icons Loading commit data...
shared Loading commit data...
sidebar Loading commit data...
styles Loading commit data...
test-util Loading commit data...
types Loading commit data...
.eslintrc Loading commit data...
karma.config.js Loading commit data...
tsconfig.json Loading commit data...