Skip to content

Commit 6b256c8

Browse files
committed
Added typescript for typechecking in Tutorial.tsx
1 parent 80c1223 commit 6b256c8

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/app/components/Tutorial.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import 'intro.js/introjs.css';
66
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
77
import { faQuestion } from '@fortawesome/free-solid-svg-icons';
88
import { tutorialSaveSeriesToggle, setCurrentTabInApp } from '../actions/actions';
9+
import { element } from 'prop-types';
910

1011
// This is the tutorial displayed when the "How to use" button is clicked
1112
// This needs to be a class component to be compatible with updateStepElement from intro.js
@@ -21,7 +22,7 @@ class Tutorial extends Component {
2122
const { currentTabInApp, dispatch } = this.props;
2223

2324
// This updates the steps so that they can target dynamically rendered elements
24-
const onChangeHandler = currentStepIndex => {
25+
const onChangeHandler = (currentStepIndex: Number) => {
2526
if (currentTabInApp === 'performance' && currentStepIndex === 1) {
2627
dispatch(tutorialSaveSeriesToggle('inputBoxOpen'));
2728
this.steps.updateStepElement(currentStepIndex);
@@ -55,8 +56,17 @@ class Tutorial extends Component {
5556
}
5657
this.setState({ stepsEnabled: true });
5758
};
58-
let steps = [];
5959

60+
interface stepsObj {
61+
title: String,
62+
element?: String,
63+
intro: String,
64+
position: String,
65+
}
66+
67+
let steps: stepsObj[] = [];
68+
69+
6070
switch (currentTabInApp) {
6171
case 'map':
6272
steps = [{
@@ -200,6 +210,9 @@ class Tutorial extends Component {
200210
break;
201211
}
202212

213+
214+
215+
203216
return (
204217
<>
205218
<Steps

0 commit comments

Comments
 (0)