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() {
let loadingTimeout = 0;
let loadingTimeout: null | ReturnType<typeof setTimeout> = 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);

View File

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

View File

@ -70,7 +70,7 @@ export default defineComponent({
chatBalloonVisible = ref(false),
//Timeout for closing the chat balloon
chatBalloonTimeout = ref(0),
chatBalloonTimeout = ref<null | ReturnType<typeof setTimeout>>(null),
//Cutoff time for chat messages
//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 readonly _loadingIndicator: HTMLDivElement;
private _delayIndicatorTimeout?: number;
private _delayIndicatorTimeout: null | ReturnType<typeof setTimeout> = 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;
}
}

View File

@ -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<typeof setTimeout> = 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 {

View File

@ -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<typeof setTimeout> = null;
private updateTimestamp: Date = new Date();
private updateInterval: number = 3000;
private worldSettings: Map<string, {
@ -479,7 +479,7 @@ export default class Pl3xmapMapProvider extends MapProvider {
clearTimeout(this.updateTimeout);
}
this.updateTimeout = 0;
this.updateTimeout = null;
}
getTilesUrl(): string {