From 93467193ad6867785b737e10d0de7be5e6223886 Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Tue, 13 Aug 2019 08:19:52 -0700 Subject: [PATCH] Migrate InteractionTracker Summary: N.B. There was one duplicate definition which TS rightfully complained about. Reviewed By: danielbuechele Differential Revision: D16764036 fbshipit-source-id: 498e4703c2363b19a3bdfa44527bde5000034095 --- src/ui/components/data-inspector/DataInspector.js | 2 +- src/ui/components/elements-inspector/elements.js | 2 +- src/utils/{InteractionTracker.js => InteractionTracker.tsx} | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) rename src/utils/{InteractionTracker.js => InteractionTracker.tsx} (83%) diff --git a/src/ui/components/data-inspector/DataInspector.js b/src/ui/components/data-inspector/DataInspector.js index 886a7d577..d6b88be9f 100644 --- a/src/ui/components/data-inspector/DataInspector.js +++ b/src/ui/components/data-inspector/DataInspector.js @@ -12,7 +12,7 @@ import Tooltip from '../Tooltip.js'; import styled from '../../styled/index.js'; import DataPreview from './DataPreview.js'; import createPaste from '../../../fb-stubs/createPaste.tsx'; -import {reportInteraction} from '../../../utils/InteractionTracker.js'; +import {reportInteraction} from '../../../utils/InteractionTracker.tsx'; import {getSortedKeys} from './utils.js'; import {colors} from '../colors.js'; import {clipboard} from 'electron'; diff --git a/src/ui/components/elements-inspector/elements.js b/src/ui/components/elements-inspector/elements.js index bf55449a7..77e62fc33 100644 --- a/src/ui/components/elements-inspector/elements.js +++ b/src/ui/components/elements-inspector/elements.js @@ -10,7 +10,7 @@ import type { Element, ElementSearchResultSet, } from './ElementsInspector.js'; -import {reportInteraction} from '../../../utils/InteractionTracker'; +import {reportInteraction} from '../../../utils/InteractionTracker.tsx'; import ContextMenu from '../ContextMenu.js'; import {PureComponent, type Element as ReactElement} from 'react'; import FlexRow from '../FlexRow.js'; diff --git a/src/utils/InteractionTracker.js b/src/utils/InteractionTracker.tsx similarity index 83% rename from src/utils/InteractionTracker.js rename to src/utils/InteractionTracker.tsx index f30a7981b..e7bd7cd8e 100644 --- a/src/utils/InteractionTracker.js +++ b/src/utils/InteractionTracker.tsx @@ -5,7 +5,7 @@ * @format */ -import {getInstance as getLogger} from '../fb-stubs/Logger.tsx'; +import {getInstance as getLogger} from '../fb-stubs/Logger'; export function reportInteraction( componentType: string, @@ -20,14 +20,13 @@ class InteractionTracker { type: string; id: string; - interaction: (name: string, data: any) => void; constructor(componentType: string, componentIdentifier: string) { this.type = componentType; this.id = componentIdentifier; } - interaction = (name: string, data: any) => { + interaction = (name: string, data: any): void => { getLogger().track('usage', 'interaction', { interaction: InteractionTracker.numberOfInteractions++, type: this.type,