fix: ts error regarding NodeJS.Timer in frontend (#254)
<!-- Please use this template for your pull request. --> <!-- Please use the sections that you need and delete other sections --> ## This PR <!-- add the description of the PR here --> @toddbaert as said, this fixes the typescript error where Node.JS Timers are returned from setInterval. ### Related Issues <!-- add here the GitHub issue that this PR resolves if applicable --> ### Notes <!-- any additional notes for this PR --> ### Follow-up Tasks <!-- anything that is related to this PR but not done here should be noted under this section --> <!-- if there is a need for a new issue, please link it here --> ### How to test <!-- if applicable, add testing instructions under this section --> Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
This commit is contained in:
parent
658e2dcb2f
commit
d4d0a38ccb
|
|
@ -10,7 +10,7 @@ export class Calculator extends React.Component<
|
|||
},
|
||||
{ millis: string | number; running: boolean; n: number }
|
||||
> {
|
||||
private interval?: NodeJS.Timer = undefined;
|
||||
private interval?: number = undefined;
|
||||
private start = 0;
|
||||
|
||||
constructor(props: {
|
||||
|
|
@ -159,7 +159,7 @@ export class Calculator extends React.Component<
|
|||
|
||||
private stopTimer() {
|
||||
if (this.interval) {
|
||||
clearInterval(this.interval);
|
||||
window.clearInterval(this.interval);
|
||||
}
|
||||
this.setState({
|
||||
running: false,
|
||||
|
|
@ -173,7 +173,7 @@ export class Calculator extends React.Component<
|
|||
this.setState({
|
||||
millis: 0,
|
||||
});
|
||||
this.interval = setInterval(() => {
|
||||
this.interval = window.setInterval(() => {
|
||||
this.setState({
|
||||
millis: new Date().getTime() - this.start,
|
||||
running: true,
|
||||
|
|
|
|||
Loading…
Reference in New Issue