From 0d14027696b50160c955ea08a928a72abaf77293 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Thu, 13 Apr 2017 17:14:50 -0700 Subject: [PATCH] Fix a few compile issues when using TS 2.3 (#24731) Tested recomppiling VSCode with TS2.3. This fixes a few issues that were discovered, including workarounds for: * https://github.com/Microsoft/TypeScript/issues/15184 * https://github.com/Microsoft/TypeScript/issues/15185 --- extensions/git/src/model.ts | 2 +- extensions/git/src/util.ts | 2 +- extensions/typescript/src/typescriptMain.ts | 7 ++++--- src/vs/base/browser/event.ts | 2 -- src/vs/workbench/services/search/node/fileSearch.ts | 9 +++++---- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/extensions/git/src/model.ts b/extensions/git/src/model.ts index 80e99c0b17c..0a60cd53e77 100644 --- a/extensions/git/src/model.ts +++ b/extensions/git/src/model.ts @@ -469,7 +469,7 @@ export class Model implements Disposable { await this.run(Operation.Sync, async () => { await this.repository.pull(); - const shouldPush = this.HEAD ? this.HEAD.ahead > 0 : true; + const shouldPush = this.HEAD && typeof this.HEAD.ahead === 'number' ? this.HEAD.ahead > 0 : true; if (shouldPush) { await this.repository.push(); diff --git a/extensions/git/src/util.ts b/extensions/git/src/util.ts index 29888e54890..08113a9f433 100644 --- a/extensions/git/src/util.ts +++ b/extensions/git/src/util.ts @@ -53,7 +53,7 @@ export function anyEvent(...events: Event[]): Event { } export function done(promise: Promise): Promise { - return promise.then(() => void 0, () => void 0); + return promise.then(() => void 0); } export function once(event: Event): Event { diff --git a/extensions/typescript/src/typescriptMain.ts b/extensions/typescript/src/typescriptMain.ts index e38f51505f8..8dd90ba5a89 100644 --- a/extensions/typescript/src/typescriptMain.ts +++ b/extensions/typescript/src/typescriptMain.ts @@ -460,7 +460,7 @@ class TypeScriptServiceClientHost implements ITypescriptServiceClientHost { public goToProjectConfig( isTypeScriptProject: boolean, resource: Uri - ): Thenable | undefined { + ): Thenable | undefined { const rootPath = workspace.rootPath; if (!rootPath) { window.showInformationMessage( @@ -480,9 +480,10 @@ class TypeScriptServiceClientHost implements ITypescriptServiceClientHost { return; } - return this.client.execute('projectInfo', { file, needFileNameList: false }).then(res => { + return this.client.execute('projectInfo', { file, needFileNameList: false } as protocol.ProjectInfoRequestArgs).then(res => { if (!res || !res.body) { - return window.showWarningMessage(localize('typescript.projectConfigCouldNotGetInfo', 'Could not determine TypeScript or JavaScript project')); + return window.showWarningMessage(localize('typescript.projectConfigCouldNotGetInfo', 'Could not determine TypeScript or JavaScript project')) + .then(() => void 0); } const { configFileName } = res.body; diff --git a/src/vs/base/browser/event.ts b/src/vs/base/browser/event.ts index 6da3585864e..010e7b03247 100644 --- a/src/vs/base/browser/event.ts +++ b/src/vs/base/browser/event.ts @@ -30,7 +30,6 @@ export interface IDomEvent { (element: EventHandler, type: 'MSPointerUp', useCapture?: boolean): _Event; (element: EventHandler, type: 'abort', useCapture?: boolean): _Event; (element: EventHandler, type: 'activate', useCapture?: boolean): _Event; - (element: EventHandler, type: 'ariarequest', useCapture?: boolean): _Event; (element: EventHandler, type: 'beforeactivate', useCapture?: boolean): _Event; (element: EventHandler, type: 'beforecopy', useCapture?: boolean): _Event; (element: EventHandler, type: 'beforecut', useCapture?: boolean): _Event; @@ -41,7 +40,6 @@ export interface IDomEvent { (element: EventHandler, type: 'canplaythrough', useCapture?: boolean): _Event; (element: EventHandler, type: 'change', useCapture?: boolean): _Event; (element: EventHandler, type: 'click', useCapture?: boolean): _Event; - (element: EventHandler, type: 'command', useCapture?: boolean): _Event; (element: EventHandler, type: 'contextmenu', useCapture?: boolean): _Event; (element: EventHandler, type: 'copy', useCapture?: boolean): _Event; (element: EventHandler, type: 'cuechange', useCapture?: boolean): _Event; diff --git a/src/vs/workbench/services/search/node/fileSearch.ts b/src/vs/workbench/services/search/node/fileSearch.ts index 81a165c082d..4ca120aab0d 100644 --- a/src/vs/workbench/services/search/node/fileSearch.ts +++ b/src/vs/workbench/services/search/node/fileSearch.ts @@ -348,7 +348,7 @@ export class FileWalker { return tree; } - private addDirectoryEntries({pathToEntries}: IDirectoryTree, base: string, relativeFiles: string[], onResult: (result: IRawFileMatch) => void) { + private addDirectoryEntries({ pathToEntries }: IDirectoryTree, base: string, relativeFiles: string[], onResult: (result: IRawFileMatch) => void) { this.cmdResultCount += relativeFiles.length; // Support relative paths to files from a root resource (ignores excludes) @@ -357,7 +357,7 @@ export class FileWalker { this.matchFile(onResult, { base: base, relativePath: this.filePattern, basename }); } - relativeFiles.forEach(function add(relativePath: string) { + function add(relativePath: string) { const basename = paths.basename(relativePath); const dirname = paths.dirname(relativePath); let entries = pathToEntries[dirname]; @@ -370,7 +370,8 @@ export class FileWalker { relativePath, basename }); - }); + } + relativeFiles.forEach(add); } private matchDirectoryTree({ rootEntries, pathToEntries }: IDirectoryTree, rootFolder: string, onResult: (result: IRawFileMatch) => void) { @@ -381,7 +382,7 @@ export class FileWalker { self.directoriesWalked++; for (let i = 0, n = entries.length; i < n; i++) { const entry = entries[i]; - const {relativePath, basename} = entry; + const { relativePath, basename } = entry; // Check exclude pattern // If the user searches for the exact file name, we adjust the glob matching -- GitLab