Typescript null (#869)

* refactor: improve null checking

* fix: return result of mutation
This commit is contained in:
Carlos Valente
2024-04-05 12:07:26 +02:00
committed by GitHub
parent 9f207dd39a
commit d432f1e3ff
12 changed files with 260 additions and 229 deletions
@@ -64,6 +64,7 @@ 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
const elapsed = timeNow - this.startedAt;
if (this.state.direction === SimpleDirection.CountDown) {
this.state.current = this.state.duration - elapsed;