mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-27 08:30:02 +03:00
fix(compose): generic types
This commit is contained in:
parent
07ac78f26d
commit
05eed818ae
|
@ -600,8 +600,8 @@ const extensionCompose =
|
|||
};
|
||||
|
||||
interface ReduxDevtoolsExtensionCompose {
|
||||
(config: Config): (...funcs: StoreEnhancer[]) => StoreEnhancer;
|
||||
(...funcs: StoreEnhancer[]): StoreEnhancer;
|
||||
(config: Config): <StoreExt>(...funcs: Array<StoreEnhancer<StoreExt>>) => StoreEnhancer<StoreExt>;
|
||||
<StoreExt>(...funcs: Array<StoreEnhancer<StoreExt>>): StoreEnhancer<StoreExt>;
|
||||
}
|
||||
|
||||
declare global {
|
||||
|
@ -610,20 +610,20 @@ declare global {
|
|||
}
|
||||
}
|
||||
|
||||
function reduxDevtoolsExtensionCompose(
|
||||
function reduxDevtoolsExtensionCompose<StoreExt>(
|
||||
config: Config
|
||||
): (...funcs: StoreEnhancer[]) => StoreEnhancer;
|
||||
function reduxDevtoolsExtensionCompose(
|
||||
...funcs: StoreEnhancer[]
|
||||
): StoreEnhancer;
|
||||
function reduxDevtoolsExtensionCompose(...funcs: [Config] | StoreEnhancer[]) {
|
||||
): (...funcs: Array<StoreEnhancer<StoreExt>>) => StoreEnhancer<StoreExt>;
|
||||
function reduxDevtoolsExtensionCompose<StoreExt>(
|
||||
...funcs: Array<StoreEnhancer<StoreExt>>
|
||||
): StoreEnhancer<StoreExt>;
|
||||
function reduxDevtoolsExtensionCompose<StoreExt>(...funcs: [Config] | Array<StoreEnhancer<StoreExt>>) {
|
||||
if (funcs.length === 0) {
|
||||
return __REDUX_DEVTOOLS_EXTENSION__();
|
||||
}
|
||||
if (funcs.length === 1 && typeof funcs[0] === 'object') {
|
||||
return extensionCompose(funcs[0]);
|
||||
}
|
||||
return extensionCompose({})(...(funcs as StoreEnhancer[]));
|
||||
return extensionCompose({})(...(funcs as Array<StoreEnhancer<StoreExt>>));
|
||||
}
|
||||
|
||||
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ = reduxDevtoolsExtensionCompose;
|
||||
|
|
|
@ -195,8 +195,8 @@ interface ReduxDevtoolsExtension {
|
|||
}
|
||||
|
||||
export interface ReduxDevtoolsExtensionCompose {
|
||||
(config: Config): (...funcs: StoreEnhancer[]) => StoreEnhancer;
|
||||
(...funcs: StoreEnhancer[]): StoreEnhancer;
|
||||
(config: Config): <StoreExt>(...funcs: Array<StoreEnhancer<StoreExt>>) => StoreEnhancer<StoreExt>;
|
||||
<StoreExt>(...funcs: Array<StoreEnhancer<StoreExt>>): StoreEnhancer<StoreExt>;
|
||||
}
|
||||
|
||||
declare global {
|
||||
|
@ -206,14 +206,14 @@ declare global {
|
|||
}
|
||||
}
|
||||
|
||||
function extensionComposeStub(
|
||||
function extensionComposeStub<StoreExt>(
|
||||
config: Config
|
||||
): (...funcs: StoreEnhancer[]) => StoreEnhancer;
|
||||
function extensionComposeStub(...funcs: StoreEnhancer[]): StoreEnhancer;
|
||||
function extensionComposeStub(...funcs: [Config] | StoreEnhancer[]) {
|
||||
): (...funcs: Array<StoreEnhancer<StoreExt>>) => StoreEnhancer<StoreExt>;
|
||||
function extensionComposeStub<StoreExt>(...funcs: Array<StoreEnhancer<StoreExt>>): StoreEnhancer<StoreExt>;
|
||||
function extensionComposeStub<StoreExt>(...funcs: [Config] | Array<StoreEnhancer<StoreExt>>) {
|
||||
if (funcs.length === 0) return undefined;
|
||||
if (typeof funcs[0] === 'object') return compose;
|
||||
return compose(...(funcs as StoreEnhancer[]));
|
||||
return compose(...(funcs as Array<StoreEnhancer<StoreExt>>));
|
||||
}
|
||||
|
||||
export const composeWithDevTools: ReduxDevtoolsExtensionCompose =
|
||||
|
|
Loading…
Reference in New Issue
Block a user