Skip to content

Commit 88f30df

Browse files
committed
Added typescript for a couple of functions
1 parent acdaee0 commit 88f30df

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/app/components/FrontendTypes.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,15 @@ export interface BarGraphProps extends BarGraphBase{
8484
snapshot: unknown,
8585
setSnapshot: () => void
8686
}
87+
88+
export interface BarGraphComparisonAction{
89+
action: ActionObj,
90+
data: ActionObj[],
91+
width: number,
92+
height: number,
93+
comparison: Series[],
94+
setSeries: (e: boolean | string) => void,
95+
series: number,
96+
setAction: (e: boolean | string) => void,
97+
}
98+

src/app/components/StateRoute/PerformanceVisx/BarGraphComparisonActions.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @ts-nocheck
1+
22
import React, { useEffect } from 'react';
33
import { BarStack } from '@visx/shape';
44
import { Group } from '@visx/group';
@@ -14,7 +14,7 @@ import MenuItem from '@material-ui/core/MenuItem';
1414
import FormControl from '@material-ui/core/FormControl';
1515
import { deleteSeries, setCurrentTabInApp } from '../../../actions/actions';
1616
import { useStoreContext } from '../../../store';
17-
import { TooltipData, Margin } from '../../FrontendTypes';
17+
import { TooltipData, Margin, BarGraphComparisonAction, ActionObj, } from '../../FrontendTypes';
1818

1919
/* DEFAULTS */
2020
const margin: Margin = {
@@ -32,7 +32,7 @@ const tooltipStyles = {
3232
fontFamily: 'Roboto',
3333
};
3434

35-
const BarGraphComparisonActions = props => {
35+
const BarGraphComparisonActions = (props: BarGraphComparisonAction) => {
3636
const [dispatch] = useStoreContext();
3737
const {
3838
width, height, data, comparison, setSeries, series, setAction, action
@@ -57,7 +57,7 @@ const BarGraphComparisonActions = props => {
5757
const { containerRef, TooltipInPortal } = useTooltipInPortal();
5858
const keys = Object.keys(data[0]).filter((componentName) => componentName !== 'name' && componentName !== 'seriesName' && componentName !== 'snapshotId');
5959
// data accessor (used to generate scales) and formatter (add units for on hover box)
60-
const getSeriesName = action => action.seriesName;
60+
const getSeriesName = (action: ActionObj):string => action.seriesName;
6161

6262
// create visualization SCALES with cleaned data.
6363
// the domain array/xAxisPoints elements will place the bars along the x-axis

0 commit comments

Comments
 (0)