|
6 | 6 | LiftedState,
|
7 | 7 | LiftedStore,
|
8 | 8 | Options,
|
| 9 | + InstrumentExt, |
9 | 10 | } from '@redux-devtools/instrument';
|
10 |
| -import { Action } from 'redux'; |
| 11 | +import { Action, StoreEnhancer } from 'redux'; |
11 | 12 |
|
12 | 13 | function logError(type: string) {
|
13 | 14 | if (type === 'NoStore') {
|
@@ -46,13 +47,32 @@ export type Monitor<
|
46 | 47 | }
|
47 | 48 | >;
|
48 | 49 |
|
| 50 | +export interface DevToolsInstance<S, A extends Action<string>, MonitorState> |
| 51 | + extends Component<Props<S, A, MonitorState>> { |
| 52 | + liftedStore?: LiftedStore<S, A, MonitorState>; |
| 53 | +} |
| 54 | + |
| 55 | +export interface DevToolsClass< |
| 56 | + S, |
| 57 | + A extends Action<string>, |
| 58 | + MonitorState, |
| 59 | + MonitorAction extends Action<string>, |
| 60 | +> { |
| 61 | + new (props: Props<S, A, MonitorState>): DevToolsInstance<S, A, MonitorState>; |
| 62 | + instrument: ( |
| 63 | + options?: Options<S, A, MonitorState, MonitorAction>, |
| 64 | + ) => StoreEnhancer<InstrumentExt<any, any, MonitorState>>; |
| 65 | +} |
| 66 | + |
49 | 67 | export default function createDevTools<
|
50 | 68 | S,
|
51 | 69 | A extends Action<string>,
|
52 | 70 | MonitorProps extends LiftedState<S, A, MonitorState>,
|
53 | 71 | MonitorState,
|
54 | 72 | MonitorAction extends Action<string>,
|
55 |
| ->(children: Monitor<S, A, MonitorProps, MonitorState, MonitorAction>) { |
| 73 | +>( |
| 74 | + children: Monitor<S, A, MonitorProps, MonitorState, MonitorAction>, |
| 75 | +): DevToolsClass<S, A, MonitorState, MonitorAction> { |
56 | 76 | const monitorElement = Children.only(children);
|
57 | 77 | const monitorProps = monitorElement.props;
|
58 | 78 | const Monitor = monitorElement.type;
|
|
0 commit comments