refactor: small type improvements (#759)

This commit is contained in:
Carlos Valente
2024-02-03 23:17:36 +01:00
committed by GitHub
parent 1890fc49d7
commit 212e5f9e68
23 changed files with 143 additions and 91 deletions
@@ -11,6 +11,7 @@ import {
UserFields,
Alias,
Settings,
HttpSettings,
} from 'ontime-types';
import { data, db } from '../../modules/loadDb.js';
@@ -98,7 +99,7 @@ export class DataProvider {
await this.persist();
}
static async setHttp(newData) {
static async setHttp(newData: HttpSettings) {
data.http = { ...newData };
await this.persist();
}
@@ -38,7 +38,8 @@ export class SimpleTimer {
public start(timeNow: number): SimpleTimerState {
if (this.state.playback === SimplePlayback.Pause) {
const elapsedSincePause = this.pausedAt - this.startedAt;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- we know these are not null in a timer that is paused
const elapsedSincePause = this.pausedAt! - this.startedAt!;
this.startedAt = timeNow - elapsedSincePause;
} else if (this.state.playback === SimplePlayback.Stop) {
this.startedAt = timeNow;