Skip to content

Commit

Permalink
fix: ts error regarding NodeJS.Timer in frontend (#254)
Browse files Browse the repository at this point in the history
<!-- 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 <[email protected]>
  • Loading branch information
lukas-reining authored Nov 22, 2023
1 parent 658e2dc commit d4d0a38
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/ui/src/app/demos/fib3r/calculator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit d4d0a38

Please sign in to comment.