Remove FlowFixMe's from TypeScript
Summary: This diff was a joy to draft. Reviewed By: jknoxville Differential Revision: D17344676 fbshipit-source-id: 0694d0393fa243edef61408ecfee92912fbbfa32
This commit is contained in:
committed by
Facebook Github Bot
parent
f41cbcd429
commit
cbbe32b9b9
@@ -367,7 +367,6 @@ export default class Client extends EventEmitter {
|
||||
this.store.getState().plugins.devicePlugins.get(params.api);
|
||||
if (persistingPlugin && persistingPlugin.persistedStateReducer) {
|
||||
let pluginKey = `${this.id}#${params.api}`;
|
||||
//$FlowFixMe
|
||||
if (persistingPlugin.prototype instanceof FlipperDevicePlugin) {
|
||||
// For device plugins, we are just using the device id instead of client id as the prefix.
|
||||
this.deviceSerial().then(
|
||||
|
||||
@@ -98,7 +98,6 @@ export function setupMenuBar(
|
||||
menuItem => menuItem.label === topLevelMenu,
|
||||
);
|
||||
if (menu) {
|
||||
// $FlowFixMe submenu is missing in electron API spec
|
||||
const menuItem = menu.submenu.items.find(
|
||||
menuItem => menuItem.label === label,
|
||||
);
|
||||
|
||||
@@ -64,7 +64,6 @@ test('persistedStateReducer is adding data', () => {
|
||||
const tablePlugin = createTablePlugin({...PROPS, method});
|
||||
const id = '1';
|
||||
|
||||
// $FlowFixMe persistedStateReducer exists for createTablePlugin
|
||||
const {rows, datas} = tablePlugin.persistedStateReducer(
|
||||
tablePlugin.defaultPersistedState,
|
||||
method,
|
||||
|
||||
@@ -107,7 +107,6 @@ export function getDynamicPlugins() {
|
||||
let dynamicPlugins: Array<PluginDefinition> = [];
|
||||
try {
|
||||
dynamicPlugins = JSON.parse(
|
||||
// $FlowFixMe process.env not defined in electron API spec
|
||||
(remote && remote.process.env.PLUGINS) || process.env.PLUGINS || '[]',
|
||||
);
|
||||
} catch (e) {
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
*/
|
||||
|
||||
import {ipcRenderer} from 'electron';
|
||||
// $FlowFixMe perf_hooks is a new API in node
|
||||
import {performance} from 'perf_hooks';
|
||||
|
||||
import {Store} from '../reducers/index';
|
||||
|
||||
@@ -157,17 +157,14 @@ export abstract class FlipperBasePlugin<
|
||||
_teardown(): void {}
|
||||
|
||||
dispatchAction(actionData: Actions) {
|
||||
// $FlowFixMe
|
||||
const action = this.reducers[actionData.type];
|
||||
if (!action) {
|
||||
// $FlowFixMe
|
||||
throw new ReferenceError(`Unknown action ${actionData.type}`);
|
||||
}
|
||||
|
||||
if (typeof action === 'function') {
|
||||
this.setState(action.call(this, this.state, actionData) as State);
|
||||
} else {
|
||||
// $FlowFixMe
|
||||
throw new TypeError(`Reducer ${actionData.type} isn't a function`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,6 @@ export default function reducer(
|
||||
return;
|
||||
}
|
||||
|
||||
// $FlowFixMe Flow doesn't know prototype
|
||||
if (p.prototype instanceof FlipperDevicePlugin) {
|
||||
// @ts-ignore doesn't know p must be typeof FlipperDevicePlugin here
|
||||
devicePlugins.set(p.id, p);
|
||||
|
||||
@@ -202,13 +202,11 @@ export default class Orderable extends React.Component<
|
||||
{passive: true},
|
||||
);
|
||||
|
||||
// $FlowFixMe
|
||||
const screenClickPos = event.nativeEvent[this.screenKey];
|
||||
|
||||
document.addEventListener(
|
||||
'mousemove',
|
||||
(this._mousemove = (event: MouseEvent) => {
|
||||
// $FlowFixMe
|
||||
const goingOpposite = event[this.screenKey] < screenClickPos;
|
||||
this.possibleMove(activeKey, goingOpposite, event, clickOffset, sizes);
|
||||
}),
|
||||
@@ -230,7 +228,7 @@ export default class Orderable extends React.Component<
|
||||
if (containerRef) {
|
||||
const containerRect: Rect = containerRef.getBoundingClientRect();
|
||||
|
||||
let newActivePos = // $FlowFixMe
|
||||
let newActivePos =
|
||||
event[this.screenKey] - containerRect[this.offsetKey] - cursorOffset;
|
||||
newActivePos = Math.max(-1, newActivePos);
|
||||
newActivePos = Math.min(
|
||||
|
||||
@@ -322,7 +322,6 @@ class ManagedTable extends React.Component<
|
||||
if (!e.shiftKey) {
|
||||
highlightedRows.clear();
|
||||
}
|
||||
// $FlowFixMe 0 <= newIndex <= rows.size - 1
|
||||
highlightedRows.add(rows.get(newIndex)!.key);
|
||||
this.onRowHighlighted(highlightedRows, () => {
|
||||
const {current} = this.tableRef;
|
||||
@@ -437,11 +436,9 @@ class ManagedTable extends React.Component<
|
||||
let startIndex = -1;
|
||||
let endIndex = -1;
|
||||
for (let i = 0; i < this.props.rows.size; i++) {
|
||||
// $FlowFixMe 0 <= newIndex <= rows.size - 1
|
||||
if (this.props.rows.get(i)!.key === fromKey) {
|
||||
startIndex = i;
|
||||
}
|
||||
// $FlowFixMe 0 <= newIndex <= rows.size - 1
|
||||
if (this.props.rows.get(i)!.key === toKey) {
|
||||
endIndex = i;
|
||||
}
|
||||
@@ -456,7 +453,6 @@ class ManagedTable extends React.Component<
|
||||
i++
|
||||
) {
|
||||
try {
|
||||
// $FlowFixMe 0 <= newIndex <= rows.size - 1
|
||||
selected.push(this.props.rows.get(i)!.key);
|
||||
} catch (e) {}
|
||||
}
|
||||
@@ -475,7 +471,6 @@ class ManagedTable extends React.Component<
|
||||
!e.shiftKey // When shift key is pressed, it's a range select not a drag select
|
||||
) {
|
||||
current.scrollToItem(index + 1);
|
||||
// $FlowFixMe 0 <= newIndex <= rows.size - 1
|
||||
const startKey = this.props.rows.get(dragStartIndex)!.key;
|
||||
const highlightedRows = new Set(this.selectInRange(startKey, row.key));
|
||||
this.onRowHighlighted(highlightedRows);
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
import electron from 'electron';
|
||||
|
||||
const _isProduction = !/node_modules[\\/]electron[\\/]/.test(
|
||||
// $FlowFixMe: execPath exists, but is not in electron API spec
|
||||
process.execPath || electron.remote.process.execPath,
|
||||
);
|
||||
|
||||
|
||||
@@ -12,8 +12,14 @@ export {};
|
||||
type RequestIdleHandle = number;
|
||||
|
||||
declare global {
|
||||
interface StoreEnhancerStateSanitizer {
|
||||
stateSanitizer: Function;
|
||||
}
|
||||
|
||||
interface Window {
|
||||
__REDUX_DEVTOOLS_EXTENSION__: undefined | StoreEnhancerStoreCreator;
|
||||
__REDUX_DEVTOOLS_EXTENSION__:
|
||||
| undefined
|
||||
| StoreEnhancerStoreCreator & StoreEnhancerStateSanitizer;
|
||||
|
||||
Flipper: {
|
||||
init: () => void;
|
||||
|
||||
Reference in New Issue
Block a user