mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-03-03 18:58:01 +03:00
Fix compatibility of createDevTools with React 19 types (#1837)
* Fix compatibility of createDevTools with React 19 types * Create fluffy-keys-doubt.md
This commit is contained in:
parent
ff60266836
commit
91f21b2ffc
5
.changeset/fluffy-keys-doubt.md
Normal file
5
.changeset/fluffy-keys-doubt.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@redux-devtools/core': patch
|
||||
---
|
||||
|
||||
Fix compatibility of createDevTools with React 19 types
|
|
@ -6,8 +6,9 @@ import {
|
|||
LiftedState,
|
||||
LiftedStore,
|
||||
Options,
|
||||
InstrumentExt,
|
||||
} from '@redux-devtools/instrument';
|
||||
import { Action } from 'redux';
|
||||
import { Action, StoreEnhancer } from 'redux';
|
||||
|
||||
function logError(type: string) {
|
||||
if (type === 'NoStore') {
|
||||
|
@ -46,13 +47,32 @@ export type Monitor<
|
|||
}
|
||||
>;
|
||||
|
||||
export interface DevToolsInstance<S, A extends Action<string>, MonitorState>
|
||||
extends Component<Props<S, A, MonitorState>> {
|
||||
liftedStore?: LiftedStore<S, A, MonitorState>;
|
||||
}
|
||||
|
||||
export interface DevToolsClass<
|
||||
S,
|
||||
A extends Action<string>,
|
||||
MonitorState,
|
||||
MonitorAction extends Action<string>,
|
||||
> {
|
||||
new (props: Props<S, A, MonitorState>): DevToolsInstance<S, A, MonitorState>;
|
||||
instrument: (
|
||||
options?: Options<S, A, MonitorState, MonitorAction>,
|
||||
) => StoreEnhancer<InstrumentExt<any, any, MonitorState>>;
|
||||
}
|
||||
|
||||
export default function createDevTools<
|
||||
S,
|
||||
A extends Action<string>,
|
||||
MonitorProps extends LiftedState<S, A, MonitorState>,
|
||||
MonitorState,
|
||||
MonitorAction extends Action<string>,
|
||||
>(children: Monitor<S, A, MonitorProps, MonitorState, MonitorAction>) {
|
||||
>(
|
||||
children: Monitor<S, A, MonitorProps, MonitorState, MonitorAction>,
|
||||
): DevToolsClass<S, A, MonitorState, MonitorAction> {
|
||||
const monitorElement = Children.only(children);
|
||||
const monitorProps = monitorElement.props;
|
||||
const Monitor = monitorElement.type;
|
||||
|
|
Loading…
Reference in New Issue
Block a user