mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-27 08:30:02 +03:00
More type fixes
This commit is contained in:
parent
b1a71b4a72
commit
f19e1fd1cb
|
@ -45,6 +45,7 @@ import { Features, State } from '../reducers/instances';
|
||||||
import { MonitorStateMonitorState } from '../reducers/monitor';
|
import { MonitorStateMonitorState } from '../reducers/monitor';
|
||||||
import { LiftedAction } from '@redux-devtools/core';
|
import { LiftedAction } from '@redux-devtools/core';
|
||||||
import { Data } from '../reducers/reports';
|
import { Data } from '../reducers/reports';
|
||||||
|
import { LiftedState } from '@redux-devtools/instrument';
|
||||||
|
|
||||||
let monitorReducer: (
|
let monitorReducer: (
|
||||||
monitorProps: unknown,
|
monitorProps: unknown,
|
||||||
|
@ -363,10 +364,10 @@ export interface LibConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RequestBase {
|
export interface RequestBase {
|
||||||
id: string;
|
id?: string;
|
||||||
instanceId?: string;
|
instanceId?: string;
|
||||||
action?: string;
|
action?: string;
|
||||||
name?: string;
|
name?: string | undefined;
|
||||||
libConfig?: LibConfig;
|
libConfig?: LibConfig;
|
||||||
actionsById?: string;
|
actionsById?: string;
|
||||||
computedStates?: string;
|
computedStates?: string;
|
||||||
|
@ -376,14 +377,15 @@ export interface RequestBase {
|
||||||
}
|
}
|
||||||
interface InitRequest extends RequestBase {
|
interface InitRequest extends RequestBase {
|
||||||
type: 'INIT';
|
type: 'INIT';
|
||||||
action: string;
|
action?: string;
|
||||||
|
payload?: string;
|
||||||
}
|
}
|
||||||
interface ActionRequest extends RequestBase {
|
interface ActionRequest extends RequestBase {
|
||||||
type: 'ACTION';
|
type: 'ACTION';
|
||||||
isExcess: boolean;
|
isExcess?: boolean;
|
||||||
nextActionId: number;
|
nextActionId: number;
|
||||||
maxAge: number;
|
maxAge: number;
|
||||||
batched: boolean;
|
batched?: boolean;
|
||||||
}
|
}
|
||||||
interface StateRequest extends RequestBase {
|
interface StateRequest extends RequestBase {
|
||||||
type: 'STATE';
|
type: 'STATE';
|
||||||
|
@ -412,7 +414,7 @@ export type Request =
|
||||||
interface UpdateStateAction {
|
interface UpdateStateAction {
|
||||||
type: typeof UPDATE_STATE;
|
type: typeof UPDATE_STATE;
|
||||||
request?: Request;
|
request?: Request;
|
||||||
id?: string;
|
id?: string | number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SetStateAction {
|
interface SetStateAction {
|
||||||
|
@ -494,8 +496,8 @@ interface UnsubscribeAction {
|
||||||
export interface EmitAction {
|
export interface EmitAction {
|
||||||
type: typeof EMIT;
|
type: typeof EMIT;
|
||||||
message: string;
|
message: string;
|
||||||
id?: string | false;
|
id?: string | number | false;
|
||||||
instanceId?: string;
|
instanceId?: string | number;
|
||||||
action?: unknown;
|
action?: unknown;
|
||||||
state?: unknown;
|
state?: unknown;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ type DispatchProps = ResolveThunks<typeof actionCreators>;
|
||||||
type Props = StateProps & DispatchProps;
|
type Props = StateProps & DispatchProps;
|
||||||
|
|
||||||
class InstanceSelector extends Component<Props> {
|
class InstanceSelector extends Component<Props> {
|
||||||
select?: { readonly value: string; readonly label: string }[];
|
select?: { readonly value: string; readonly label: string | number }[];
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
this.select = [{ value: '', label: 'Autoselect instances' }];
|
this.select = [{ value: '', label: 'Autoselect instances' }];
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { Dispatch, MiddlewareAPI } from 'redux';
|
||||||
import { ExportRequest, StoreAction } from '../actions';
|
import { ExportRequest, StoreAction } from '../actions';
|
||||||
import { StoreState } from '../reducers';
|
import { StoreState } from '../reducers';
|
||||||
|
|
||||||
let toExport: string | undefined;
|
let toExport: string | number | undefined;
|
||||||
|
|
||||||
function download(state: string) {
|
function download(state: string) {
|
||||||
const blob = new Blob([state], { type: 'octet/stream' });
|
const blob = new Blob([state], { type: 'octet/stream' });
|
||||||
|
|
|
@ -34,8 +34,8 @@ export interface Features {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Options {
|
export interface Options {
|
||||||
name?: string;
|
name?: string | number;
|
||||||
connectionId?: string;
|
connectionId?: string | number;
|
||||||
explicitLib?: string;
|
explicitLib?: string;
|
||||||
lib?: string;
|
lib?: string;
|
||||||
actionCreators?: ActionCreator[];
|
actionCreators?: ActionCreator[];
|
||||||
|
@ -57,9 +57,9 @@ export interface State {
|
||||||
|
|
||||||
export interface InstancesState {
|
export interface InstancesState {
|
||||||
selected: string | null;
|
selected: string | null;
|
||||||
current: string;
|
current: string | number;
|
||||||
sync: boolean;
|
sync: boolean;
|
||||||
connections: { [id: string]: string[] };
|
connections: { [id: string]: (string | number)[] };
|
||||||
options: { [id: string]: Options };
|
options: { [id: string]: Options };
|
||||||
states: { [id: string]: State };
|
states: { [id: string]: State };
|
||||||
persisted?: boolean;
|
persisted?: boolean;
|
||||||
|
@ -86,7 +86,7 @@ export const initialState: InstancesState = {
|
||||||
function updateState(
|
function updateState(
|
||||||
state: { [id: string]: State },
|
state: { [id: string]: State },
|
||||||
request: Request,
|
request: Request,
|
||||||
id: string,
|
id: string | number,
|
||||||
serialize: boolean | undefined
|
serialize: boolean | undefined
|
||||||
) {
|
) {
|
||||||
let payload: State = request.payload as State;
|
let payload: State = request.payload as State;
|
||||||
|
@ -268,8 +268,8 @@ function removeState(state: InstancesState, connectionId: string) {
|
||||||
|
|
||||||
function init(
|
function init(
|
||||||
{ type, action, name, libConfig = {} }: Request,
|
{ type, action, name, libConfig = {} }: Request,
|
||||||
connectionId: string,
|
connectionId: string | number,
|
||||||
current: string
|
current: string | number
|
||||||
): Options {
|
): Options {
|
||||||
let lib;
|
let lib;
|
||||||
let actionCreators;
|
let actionCreators;
|
||||||
|
@ -310,7 +310,7 @@ export default function instances(
|
||||||
case UPDATE_STATE: {
|
case UPDATE_STATE: {
|
||||||
const { request } = action;
|
const { request } = action;
|
||||||
if (!request) return state;
|
if (!request) return state;
|
||||||
const connectionId = action.id || request.id;
|
const connectionId = (action.id || request.id)!;
|
||||||
const current = request.instanceId || connectionId;
|
const current = request.instanceId || connectionId;
|
||||||
let connections = state.connections;
|
let connections = state.connections;
|
||||||
let options = state.options;
|
let options = state.options;
|
||||||
|
|
|
@ -23,7 +23,7 @@ export function sweep(state: State): State {
|
||||||
export function nonReduxDispatch(
|
export function nonReduxDispatch(
|
||||||
store: MiddlewareAPI<Dispatch<StoreAction>, StoreState>,
|
store: MiddlewareAPI<Dispatch<StoreAction>, StoreState>,
|
||||||
message: string,
|
message: string,
|
||||||
instanceId: string,
|
instanceId: string | number,
|
||||||
action: DispatchAction,
|
action: DispatchAction,
|
||||||
initialState: string | undefined,
|
initialState: string | undefined,
|
||||||
preInstances?: InstancesState
|
preInstances?: InstancesState
|
||||||
|
|
Loading…
Reference in New Issue
Block a user