From 26803cee9b0b86d990e8dced73410be367df2084 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Thu, 10 Sep 2020 11:34:52 +0200 Subject: [PATCH] Fix TS 4.1 errors for tasks and remote explorer Part of #106358 --- src/vs/workbench/contrib/remote/browser/remote.ts | 5 +++-- .../workbench/contrib/tasks/browser/runAutomaticTasks.ts | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/vs/workbench/contrib/remote/browser/remote.ts b/src/vs/workbench/contrib/remote/browser/remote.ts index af5e7bdee76f6..5f0ea48fe893c 100644 --- a/src/vs/workbench/contrib/remote/browser/remote.ts +++ b/src/vs/workbench/contrib/remote/browser/remote.ts @@ -286,10 +286,11 @@ class HelpItemValue { const emptyString: Promise = new Promise(resolve => setTimeout(() => resolve(''), 500)); this._url = await Promise.race([urlCommand, emptyString]); } - } else { - this._url = ''; } } + if (this._url === undefined) { + this._url = ''; + } resolve(this._url); }); } diff --git a/src/vs/workbench/contrib/tasks/browser/runAutomaticTasks.ts b/src/vs/workbench/contrib/tasks/browser/runAutomaticTasks.ts index c17c12d9b7690..4b20d3ac1e059 100644 --- a/src/vs/workbench/contrib/tasks/browser/runAutomaticTasks.ts +++ b/src/vs/workbench/contrib/tasks/browser/runAutomaticTasks.ts @@ -38,7 +38,7 @@ export class RunAutomaticTasks extends Disposable implements IWorkbenchContribut } } - private static runTasks(taskService: ITaskService, tasks: Array>) { + private static runTasks(taskService: ITaskService, tasks: Array>) { tasks.forEach(task => { if (task instanceof Promise) { task.then(promiseResult => { @@ -52,8 +52,8 @@ export class RunAutomaticTasks extends Disposable implements IWorkbenchContribut }); } - private static findAutoTasks(taskService: ITaskService, workspaceTaskResult: Map): { tasks: Array>, taskNames: Array } { - const tasks = new Array>(); + private static findAutoTasks(taskService: ITaskService, workspaceTaskResult: Map): { tasks: Array>, taskNames: Array } { + const tasks = new Array>(); const taskNames = new Array(); if (workspaceTaskResult) { workspaceTaskResult.forEach(resultElement => { @@ -68,7 +68,7 @@ export class RunAutomaticTasks extends Disposable implements IWorkbenchContribut if (resultElement.configurations) { forEach(resultElement.configurations.byIdentifier, (configedTask) => { if (configedTask.value.runOptions.runOn === RunOnOptions.folderOpen) { - tasks.push(new Promise(resolve => { + tasks.push(new Promise(resolve => { taskService.getTask(resultElement.workspaceFolder, configedTask.value._id, true).then(task => resolve(task)); })); if (configedTask.value._label) {