From bfd2b4083f13dd087939ddcd2eeac416fac845ee Mon Sep 17 00:00:00 2001 From: James Lyne Date: Sun, 12 Sep 2021 20:37:51 +0100 Subject: [PATCH] Fix type errors --- src/App.vue | 8 ++++---- src/components/map/layer/MapLayer.vue | 2 +- src/components/map/marker/PlayerMarker.vue | 2 +- src/leaflet/control/LoadingControl.ts | 6 +++--- src/providers/DynmapMapProvider.ts | 4 ++-- src/providers/Pl3xmapMapProvider.ts | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/App.vue b/src/App.vue index f35743f..5c65efb 100644 --- a/src/App.vue +++ b/src/App.vue @@ -46,7 +46,7 @@ export default defineComponent({ }, setup() { - let loadingTimeout = 0; + let loadingTimeout: null | ReturnType = null; const store = useStore(), title = computed(() => store.getters.pageTitle), @@ -70,7 +70,7 @@ export default defineComponent({ loadConfiguration = async () => { try { - clearTimeout(loadingTimeout); + clearTimeout(Number(loadingTimeout)); showSplash(!loadingAttempts.value); loading.value = true; @@ -93,7 +93,7 @@ export default defineComponent({ console.error(`${error}:`, e); showSplashError(`${error}\n${e}`, false, ++loadingAttempts.value); - clearTimeout(loadingTimeout); + clearTimeout(Number(loadingTimeout)); loadingTimeout = setTimeout(() => loadConfiguration(), 1000); } } finally { @@ -208,7 +208,7 @@ export default defineComponent({ }); onBeforeUnmount(() => { store.dispatch(ActionTypes.STOP_UPDATES, undefined); - clearTimeout(loadingTimeout); + clearTimeout(Number(loadingTimeout)); window.removeEventListener('resize', onResize); window.removeEventListener('keydown', onKeydown); diff --git a/src/components/map/layer/MapLayer.vue b/src/components/map/layer/MapLayer.vue index 98d1266..0f4c6f6 100644 --- a/src/components/map/layer/MapLayer.vue +++ b/src/components/map/layer/MapLayer.vue @@ -43,7 +43,7 @@ export default defineComponent({ const store = useStore(), active = computed(() => props.map === store.state.currentMap); - let refreshTimeout = 0, + let refreshTimeout: null | ReturnType = null, layer: LiveAtlasTileLayer; const refresh = () => { diff --git a/src/components/map/marker/PlayerMarker.vue b/src/components/map/marker/PlayerMarker.vue index 0375494..993cba4 100644 --- a/src/components/map/marker/PlayerMarker.vue +++ b/src/components/map/marker/PlayerMarker.vue @@ -70,7 +70,7 @@ export default defineComponent({ chatBalloonVisible = ref(false), //Timeout for closing the chat balloon - chatBalloonTimeout = ref(0), + chatBalloonTimeout = ref>(null), //Cutoff time for chat messages //Only messages newer than this time will be shown in the chat balloon diff --git a/src/leaflet/control/LoadingControl.ts b/src/leaflet/control/LoadingControl.ts index 55c9d19..491453c 100644 --- a/src/leaflet/control/LoadingControl.ts +++ b/src/leaflet/control/LoadingControl.ts @@ -42,7 +42,7 @@ export class LoadingControl extends Control { private _dataLoaders: Set = new Set(); private readonly _loadingIndicator: HTMLDivElement; - private _delayIndicatorTimeout?: number; + private _delayIndicatorTimeout: null | ReturnType = null; constructor(options: LoadingControlOptions) { super(options); @@ -78,7 +78,7 @@ export class LoadingControl extends Control { // already waiting for that delay, set up a timeout. this._delayIndicatorTimeout = setTimeout(() => { this.updateIndicator(); - this._delayIndicatorTimeout = undefined; + this._delayIndicatorTimeout = null; }, this.options.delayIndicator); } else { // Otherwise show the indicator immediately @@ -95,7 +95,7 @@ export class LoadingControl extends Control { // triggering the indicator. if (this.options.delayIndicator && this._delayIndicatorTimeout && !this.isLoading()) { clearTimeout(this._delayIndicatorTimeout); - this._delayIndicatorTimeout = undefined; + this._delayIndicatorTimeout = null; } } diff --git a/src/providers/DynmapMapProvider.ts b/src/providers/DynmapMapProvider.ts index f776c88..d5e41fb 100644 --- a/src/providers/DynmapMapProvider.ts +++ b/src/providers/DynmapMapProvider.ts @@ -41,7 +41,7 @@ export default class DynmapMapProvider extends MapProvider { private updateAbort?: AbortController = undefined; private updatesEnabled = false; - private updateTimeout: number = 0; + private updateTimeout: null | ReturnType = null; private updateTimestamp: Date = new Date(); private updateInterval: number = 3000; @@ -257,7 +257,7 @@ export default class DynmapMapProvider extends MapProvider { clearTimeout(this.updateTimeout); } - this.updateTimeout = 0; + this.updateTimeout = null; } getTilesUrl(): string { diff --git a/src/providers/Pl3xmapMapProvider.ts b/src/providers/Pl3xmapMapProvider.ts index 7bd2982..596190c 100644 --- a/src/providers/Pl3xmapMapProvider.ts +++ b/src/providers/Pl3xmapMapProvider.ts @@ -34,7 +34,7 @@ export default class Pl3xmapMapProvider extends MapProvider { private playersAbort?: AbortController = undefined; private updatesEnabled = false; - private updateTimeout: number = 0; + private updateTimeout: null | ReturnType = null; private updateTimestamp: Date = new Date(); private updateInterval: number = 3000; private worldSettings: Map