Fix type errors

This commit is contained in:
James Lyne 2021-09-12 20:37:51 +01:00
parent 7e647b7c19
commit bfd2b4083f
6 changed files with 13 additions and 13 deletions

View File

@ -46,7 +46,7 @@ export default defineComponent({
}, },
setup() { setup() {
let loadingTimeout = 0; let loadingTimeout: null | ReturnType<typeof setTimeout> = null;
const store = useStore(), const store = useStore(),
title = computed(() => store.getters.pageTitle), title = computed(() => store.getters.pageTitle),
@ -70,7 +70,7 @@ export default defineComponent({
loadConfiguration = async () => { loadConfiguration = async () => {
try { try {
clearTimeout(loadingTimeout); clearTimeout(Number(loadingTimeout));
showSplash(!loadingAttempts.value); showSplash(!loadingAttempts.value);
loading.value = true; loading.value = true;
@ -93,7 +93,7 @@ export default defineComponent({
console.error(`${error}:`, e); console.error(`${error}:`, e);
showSplashError(`${error}\n${e}`, false, ++loadingAttempts.value); showSplashError(`${error}\n${e}`, false, ++loadingAttempts.value);
clearTimeout(loadingTimeout); clearTimeout(Number(loadingTimeout));
loadingTimeout = setTimeout(() => loadConfiguration(), 1000); loadingTimeout = setTimeout(() => loadConfiguration(), 1000);
} }
} finally { } finally {
@ -208,7 +208,7 @@ export default defineComponent({
}); });
onBeforeUnmount(() => { onBeforeUnmount(() => {
store.dispatch(ActionTypes.STOP_UPDATES, undefined); store.dispatch(ActionTypes.STOP_UPDATES, undefined);
clearTimeout(loadingTimeout); clearTimeout(Number(loadingTimeout));
window.removeEventListener('resize', onResize); window.removeEventListener('resize', onResize);
window.removeEventListener('keydown', onKeydown); window.removeEventListener('keydown', onKeydown);

View File

@ -43,7 +43,7 @@ export default defineComponent({
const store = useStore(), const store = useStore(),
active = computed(() => props.map === store.state.currentMap); active = computed(() => props.map === store.state.currentMap);
let refreshTimeout = 0, let refreshTimeout: null | ReturnType<typeof setTimeout> = null,
layer: LiveAtlasTileLayer; layer: LiveAtlasTileLayer;
const refresh = () => { const refresh = () => {

View File

@ -70,7 +70,7 @@ export default defineComponent({
chatBalloonVisible = ref(false), chatBalloonVisible = ref(false),
//Timeout for closing the chat balloon //Timeout for closing the chat balloon
chatBalloonTimeout = ref(0), chatBalloonTimeout = ref<null | ReturnType<typeof setTimeout>>(null),
//Cutoff time for chat messages //Cutoff time for chat messages
//Only messages newer than this time will be shown in the chat balloon //Only messages newer than this time will be shown in the chat balloon

View File

@ -42,7 +42,7 @@ export class LoadingControl extends Control {
private _dataLoaders: Set<number> = new Set(); private _dataLoaders: Set<number> = new Set();
private readonly _loadingIndicator: HTMLDivElement; private readonly _loadingIndicator: HTMLDivElement;
private _delayIndicatorTimeout?: number; private _delayIndicatorTimeout: null | ReturnType<typeof setTimeout> = null;
constructor(options: LoadingControlOptions) { constructor(options: LoadingControlOptions) {
super(options); super(options);
@ -78,7 +78,7 @@ export class LoadingControl extends Control {
// already waiting for that delay, set up a timeout. // already waiting for that delay, set up a timeout.
this._delayIndicatorTimeout = setTimeout(() => { this._delayIndicatorTimeout = setTimeout(() => {
this.updateIndicator(); this.updateIndicator();
this._delayIndicatorTimeout = undefined; this._delayIndicatorTimeout = null;
}, this.options.delayIndicator); }, this.options.delayIndicator);
} else { } else {
// Otherwise show the indicator immediately // Otherwise show the indicator immediately
@ -95,7 +95,7 @@ export class LoadingControl extends Control {
// triggering the indicator. // triggering the indicator.
if (this.options.delayIndicator && this._delayIndicatorTimeout && !this.isLoading()) { if (this.options.delayIndicator && this._delayIndicatorTimeout && !this.isLoading()) {
clearTimeout(this._delayIndicatorTimeout); clearTimeout(this._delayIndicatorTimeout);
this._delayIndicatorTimeout = undefined; this._delayIndicatorTimeout = null;
} }
} }

View File

@ -41,7 +41,7 @@ export default class DynmapMapProvider extends MapProvider {
private updateAbort?: AbortController = undefined; private updateAbort?: AbortController = undefined;
private updatesEnabled = false; private updatesEnabled = false;
private updateTimeout: number = 0; private updateTimeout: null | ReturnType<typeof setTimeout> = null;
private updateTimestamp: Date = new Date(); private updateTimestamp: Date = new Date();
private updateInterval: number = 3000; private updateInterval: number = 3000;
@ -257,7 +257,7 @@ export default class DynmapMapProvider extends MapProvider {
clearTimeout(this.updateTimeout); clearTimeout(this.updateTimeout);
} }
this.updateTimeout = 0; this.updateTimeout = null;
} }
getTilesUrl(): string { getTilesUrl(): string {

View File

@ -34,7 +34,7 @@ export default class Pl3xmapMapProvider extends MapProvider {
private playersAbort?: AbortController = undefined; private playersAbort?: AbortController = undefined;
private updatesEnabled = false; private updatesEnabled = false;
private updateTimeout: number = 0; private updateTimeout: null | ReturnType<typeof setTimeout> = null;
private updateTimestamp: Date = new Date(); private updateTimestamp: Date = new Date();
private updateInterval: number = 3000; private updateInterval: number = 3000;
private worldSettings: Map<string, { private worldSettings: Map<string, {
@ -479,7 +479,7 @@ export default class Pl3xmapMapProvider extends MapProvider {
clearTimeout(this.updateTimeout); clearTimeout(this.updateTimeout);
} }
this.updateTimeout = 0; this.updateTimeout = null;
} }
getTilesUrl(): string { getTilesUrl(): string {