Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove DefaultIfAny helper #4349

Merged
merged 1 commit into from
Mar 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions src/sidebar/store/create-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,6 @@ import { createReducer, bindSelectors } from './util';
* @prop {RootSelectors} [rootSelectors]
*/

/**
* Replace a type `T` with `Fallback` if `T` is `any`.
*
* Based on https://stackoverflow.com/a/61626123/434243.
*
* @template T
* @template Fallback
* @typedef {0 extends (1 & T) ? Fallback : T} DefaultIfAny
*/

/**
* Helper for getting the type of store produced by `createStore` when
* passed a given module.
Expand All @@ -77,7 +67,7 @@ import { createReducer, bindSelectors } from './util';
*
* @template T
* @typedef {T extends Module<any, infer Actions, infer Selectors, infer RootSelectors> ?
* Store<Actions,Selectors,DefaultIfAny<RootSelectors,{}>> : never} StoreFromModule
* Store<Actions,Selectors,RootSelectors> : never} StoreFromModule
*/

/**
Expand Down Expand Up @@ -196,7 +186,7 @@ export function createStore(modules, initArgs = [], middleware = []) {
* @template State
* @template Actions
* @template {SelectorMap<State>} Selectors
* @template RootSelectors
* @template [RootSelectors={}]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rootSelectors property of store modules is optional. In store modules without it, this treats it as if it were an empty object.

* @param {State | ((...args: any[]) => State)} initialState
* @param {object} config
* @param {string} config.namespace -
Expand Down