debt - reduce explicit any or casts

This commit is contained in:
Benjamin Pasero
2019-04-01 08:11:11 +02:00
parent 4889af53ea
commit 64c3f1a93e
105 changed files with 354 additions and 333 deletions

View File

@@ -20,7 +20,7 @@ export class LogsDataCleaner extends Disposable {
}
private cleanUpOldLogsSoon(): void {
let handle: any = setTimeout(() => {
let handle: NodeJS.Timeout | undefined = setTimeout(() => {
handle = undefined;
const currentLog = basename(this.environmentService.logsPath);
@@ -35,6 +35,11 @@ export class LogsDataCleaner extends Disposable {
}).then(null, onUnexpectedError);
}, 10 * 1000);
this._register(toDisposable(() => clearTimeout(handle)));
this._register(toDisposable(() => {
if (handle) {
clearTimeout(handle);
handle = undefined;
}
}));
}
}

View File

@@ -5,7 +5,7 @@
import { basename, dirname, join } from 'vs/base/common/path';
import { onUnexpectedError } from 'vs/base/common/errors';
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import { dispose, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import { readdir, rimraf, stat } from 'vs/base/node/pfs';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import product from 'vs/platform/product/node/product';
@@ -41,13 +41,13 @@ export class NodeCachedDataCleaner {
const nodeCachedDataRootDir = dirname(this._environmentService.nodeCachedDataDir);
const nodeCachedDataCurrent = basename(this._environmentService.nodeCachedDataDir);
let handle: any = setTimeout(() => {
let handle: NodeJS.Timeout | undefined = setTimeout(() => {
handle = undefined;
readdir(nodeCachedDataRootDir).then(entries => {
const now = Date.now();
const deletes: Promise<any>[] = [];
const deletes: Promise<unknown>[] = [];
entries.forEach(entry => {
// name check
@@ -76,8 +76,11 @@ export class NodeCachedDataCleaner {
}, 30 * 1000);
this._disposables.push({
dispose() { clearTimeout(handle); }
});
this._disposables.push(toDisposable(() => {
if (handle) {
clearTimeout(handle);
handle = undefined;
}
}));
}
}

View File

@@ -24,7 +24,7 @@ export class StorageDataCleaner extends Disposable {
}
private cleanUpStorageSoon(): void {
let handle: any = setTimeout(() => {
let handle: NodeJS.Timeout | undefined = setTimeout(() => {
handle = undefined;
// Leverage the backup workspace file to find out which empty workspace is currently in use to
@@ -52,6 +52,11 @@ export class StorageDataCleaner extends Disposable {
}).then(null, onUnexpectedError);
}, 30 * 1000);
this._register(toDisposable(() => clearTimeout(handle)));
this._register(toDisposable(() => {
if (handle) {
clearTimeout(handle);
handle = undefined;
}
}));
}
}