refactor: use strict typing

This commit is contained in:
Carlos Valente
2025-03-21 19:44:16 +01:00
committed by arc-alex
parent 14a7c04d3b
commit d48b2ae506
39 changed files with 339 additions and 246 deletions
+10 -2
View File
@@ -1,11 +1,11 @@
import { timerConfig } from '../setup/config.js';
import * as runtimeState from '../stores/runtimeState.js';
import type { UpdateResult } from '../stores/runtimeState.js';
import { timerConfig } from '../config/config.js';
type UpdateCallbackFn = (updateResult: UpdateResult) => void;
/**
* Service manages Ontime's main timer
* Manages Ontime's main timer
*/
export class EventTimer {
private readonly _interval: NodeJS.Timeout;
@@ -43,6 +43,14 @@ export class EventTimer {
}
const state = runtimeState.getState();
// eslint-disable-next-line no-unused-labels -- dev code path
DEV: {
if (state.timer.current === null) {
throw new Error('EventTimer.start: invalid state received');
}
}
const endTime = state.timer.current - timerConfig.triggerAhead;
this.endCallback = setTimeout(() => this.update(), endTime);
return true;