UNPKG

3.41 kBTypeScriptView Raw
1import React from 'react';
2import PropTypes from 'prop-types';
3import { EnhancedStore, LiftedState, LiftedStore, Options } from 'redux-devtools-instrument';
4import { Action } from 'redux';
5export interface Props<S, A extends Action<unknown>, MonitorState, MonitorAction extends Action<unknown>> {
6 store?: EnhancedStore<S, A, MonitorState>;
7}
8export declare type Monitor<S, A extends Action<unknown>, MonitorProps extends LiftedState<S, A, MonitorState>, MonitorState, MonitorAction extends Action<unknown>> = React.ReactElement<MonitorProps, React.ComponentType<MonitorProps & LiftedState<S, A, MonitorState>> & {
9 update(monitorProps: MonitorProps, state: MonitorState | undefined, action: MonitorAction): MonitorState;
10}>;
11export default function createDevTools<S, A extends Action<unknown>, MonitorProps extends LiftedState<S, A, MonitorState>, MonitorState, MonitorAction extends Action<unknown>>(children: Monitor<S, A, MonitorProps, MonitorState, MonitorAction>): {
12 new (props: Props<S, A, MonitorState, MonitorAction>, context: {
13 store?: EnhancedStore<S, A, MonitorState>;
14 }): {
15 liftedStore?: LiftedStore<S, A, MonitorState> | undefined;
16 render(): JSX.Element | null;
17 context: any;
18 setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Props<S, A, MonitorState, MonitorAction>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
19 forceUpdate(callback?: (() => void) | undefined): void;
20 readonly props: Readonly<Props<S, A, MonitorState, MonitorAction>> & Readonly<{
21 children?: React.ReactNode;
22 }>;
23 state: Readonly<{}>;
24 refs: {
25 [key: string]: React.ReactInstance;
26 };
27 componentDidMount?(): void;
28 shouldComponentUpdate?(nextProps: Readonly<Props<S, A, MonitorState, MonitorAction>>, nextState: Readonly<{}>, nextContext: any): boolean;
29 componentWillUnmount?(): void;
30 componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
31 getSnapshotBeforeUpdate?(prevProps: Readonly<Props<S, A, MonitorState, MonitorAction>>, prevState: Readonly<{}>): any;
32 componentDidUpdate?(prevProps: Readonly<Props<S, A, MonitorState, MonitorAction>>, prevState: Readonly<{}>, snapshot?: any): void;
33 componentWillMount?(): void;
34 UNSAFE_componentWillMount?(): void;
35 componentWillReceiveProps?(nextProps: Readonly<Props<S, A, MonitorState, MonitorAction>>, nextContext: any): void;
36 UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Props<S, A, MonitorState, MonitorAction>>, nextContext: any): void;
37 componentWillUpdate?(nextProps: Readonly<Props<S, A, MonitorState, MonitorAction>>, nextState: Readonly<{}>, nextContext: any): void;
38 UNSAFE_componentWillUpdate?(nextProps: Readonly<Props<S, A, MonitorState, MonitorAction>>, nextState: Readonly<{}>, nextContext: any): void;
39 };
40 contextTypes: {
41 store: PropTypes.Requireable<object>;
42 };
43 propTypes: {
44 store: PropTypes.Requireable<object>;
45 };
46 instrument: (options?: Options<S, A, MonitorState, MonitorAction> | undefined) => import("redux").StoreEnhancer<import("redux-devtools-instrument").InstrumentExt<any, any, MonitorState>, {}>;
47 contextType?: React.Context<any> | undefined;
48};