refactor: use strict typing

This commit is contained in:
Carlos Valente
2025-03-21 19:44:16 +01:00
committed by Carlos Valente
parent 4ed38340e0
commit 178640bfc4
39 changed files with 339 additions and 246 deletions
@@ -86,6 +86,12 @@ export class SimpleTimer {
public update(timeNow: number): SimpleTimerState {
if (this.state.playback === SimplePlayback.Start) {
// we know startedAt is not null since we are in play mode
// eslint-disable-next-line no-unused-labels -- dev code path
DEV: {
if (this.startedAt === null) {
throw new Error('SimpleTimer.update: invalid state received');
}
}
const elapsed = timeNow - this.startedAt;
if (this.state.direction === SimpleDirection.CountDown) {
this.state.current = this.state.duration - elapsed;