Add types to reduxDevToolsConfig

Summary: Getting rid of a flowfixme, part of T47375728

Reviewed By: passy

Differential Revision: D16336917

fbshipit-source-id: 163734796b72ba2c8971f27ce213baf7ca3f23a1
This commit is contained in:
John Knox
2019-07-18 06:21:15 -07:00
committed by Facebook Github Bot
parent 0261f17785
commit b4585ef72c

View File

@@ -4,39 +4,32 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
* @format * @format
*/ */
import type {State} from '../reducers/index';
import type {DeviceExport} from '../devices/BaseDevice';
// $FlowFixMe T47375728 export const stateSanitizer = (state: State) => {
export const stateSanitizer = state => { if (state.connections && state.connections.devices) {
let sanitizedState = state; const {devices} = state.connections;
if (state.connections) { const {selectedDevice} = state.connections;
if (state.connections.devices) { return {
const {devices} = state.connections; ...state,
sanitizedState = { connections: {
...sanitizedState, ...state.connections,
connections: { devices: devices.map<DeviceExport>(device => {
...state.connections, return {
devices: devices.map(device => { ...device.toJSON(),
return { logs: [],
...device.toJSON(), };
logs: '<<DEVICE_LOGS>>', }),
}; selectedDevice: selectedDevice
}), ? {
}, ...selectedDevice.toJSON(),
}; logs: [],
} }
if (state.connections.selectedDevice) { : null,
const {selectedDevice} = state.connections; },
sanitizedState = { };
...sanitizedState,
connections: {
...sanitizedState.connections,
selectedDevice: {
...selectedDevice.toJSON(),
logs: '<<DEVICE_LOGS>>',
},
},
};
}
} }
return sanitizedState;
return state;
}; };