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;
if (state.connections) {
if (state.connections.devices) {
const {devices} = state.connections; const {devices} = state.connections;
sanitizedState = { const {selectedDevice} = state.connections;
...sanitizedState, return {
...state,
connections: { connections: {
...state.connections, ...state.connections,
devices: devices.map(device => { devices: devices.map<DeviceExport>(device => {
return { return {
...device.toJSON(), ...device.toJSON(),
logs: '<<DEVICE_LOGS>>', logs: [],
}; };
}), }),
}, selectedDevice: selectedDevice
}; ? {
}
if (state.connections.selectedDevice) {
const {selectedDevice} = state.connections;
sanitizedState = {
...sanitizedState,
connections: {
...sanitizedState.connections,
selectedDevice: {
...selectedDevice.toJSON(), ...selectedDevice.toJSON(),
logs: '<<DEVICE_LOGS>>', logs: [],
}, }
: null,
}, },
}; };
} }
}
return sanitizedState; return state;
}; };