-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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] microsoft/TypeScript#43403
- Loading branch information
1 parent
a118356
commit 4fd547b
Showing
1 changed file
with
24 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters