Remove deprecated creation of store (#946)

This commit is contained in:
Nathan Bierema 2021-11-05 16:22:04 -04:00 committed by GitHub
parent b79886eb50
commit 5c375330b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,13 +10,11 @@ import {
Dispatch, Dispatch,
PreloadedState, PreloadedState,
Reducer, Reducer,
Store,
StoreEnhancer, StoreEnhancer,
StoreEnhancerStoreCreator, StoreEnhancerStoreCreator,
} from 'redux'; } from 'redux';
import Immutable from 'immutable'; import Immutable from 'immutable';
import { EnhancedStore, PerformAction } from '@redux-devtools/instrument'; import { EnhancedStore, PerformAction } from '@redux-devtools/instrument';
import createStore from '../../../app/stores/createStore';
import configureStore, { getUrlParam } from '../../../app/stores/enhancerStore'; import configureStore, { getUrlParam } from '../../../app/stores/enhancerStore';
import { isAllowed, Options } from '../options/syncOptions'; import { isAllowed, Options } from '../options/syncOptions';
import Monitor from '../../../app/service/Monitor'; import Monitor from '../../../app/service/Monitor';
@ -133,11 +131,6 @@ export interface Config extends ConfigWithExpandedMaxAge {
} }
interface ReduxDevtoolsExtension { interface ReduxDevtoolsExtension {
<S, A extends Action<unknown>>(
reducer: Reducer<S, A>,
preloadedState?: PreloadedState<S>,
config?: Config
): Store<S, A>;
(config?: Config): StoreEnhancer; (config?: Config): StoreEnhancer;
open: (position?: Position) => void; open: (position?: Position) => void;
updateStore: ( updateStore: (
@ -167,21 +160,10 @@ declare global {
} }
function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>( function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
reducer?: Reducer<S, A>,
preloadedState?: PreloadedState<S>,
config?: Config config?: Config
): Store<S, A>; ): StoreEnhancer {
function __REDUX_DEVTOOLS_EXTENSION__(config: Config): StoreEnhancer;
function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
reducer?: Reducer<S, A> | Config | undefined,
preloadedState?: PreloadedState<S>,
config?: Config
): Store<S, A> | StoreEnhancer {
/* eslint-disable no-param-reassign */ /* eslint-disable no-param-reassign */
if (typeof reducer === 'object') { if (typeof config !== 'object') config = {};
config = reducer;
reducer = undefined;
} else if (typeof config !== 'object') config = {};
/* eslint-enable no-param-reassign */ /* eslint-enable no-param-reassign */
if (!window.devToolsOptions) window.devToolsOptions = {} as any; if (!window.devToolsOptions) window.devToolsOptions = {} as any;
@ -570,13 +552,7 @@ function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
}; };
}; };
if (!reducer) return enhance(); return enhance();
/* eslint-disable no-console */
console.warn(
'Creating a Redux store directly from DevTools extension is discouraged and will not be supported in future major version. For more details see: https://git.io/fphCe'
);
/* eslint-enable no-console */
return createStore(reducer, preloadedState, enhance);
} }
declare global { declare global {