Skip to content

Commit

Permalink
Remove DefaultIfAny helper
Browse files Browse the repository at this point in the history
Remove a cryptic piece of code that is no longer needed given the ability to
specify default values for template arguments [1]

[1] microsoft/TypeScript#45483
  • Loading branch information
robertknight committed Mar 24, 2022
1 parent a95447b commit 0a6294a
Showing 1 changed file with 2 additions and 12 deletions.
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={}]
* @param {State | ((...args: any[]) => State)} initialState
* @param {object} config
* @param {string} config.namespace -
Expand Down

0 comments on commit 0a6294a

Please sign in to comment.