提交 0d140276 编写于 作者: M Matt Bierner 提交者: GitHub

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
上级 1d05d0c4
......@@ -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();
......
......@@ -53,7 +53,7 @@ export function anyEvent<T>(...events: Event<T>[]): Event<T> {
}
export function done<T>(promise: Promise<T>): Promise<void> {
return promise.then<void>(() => void 0, () => void 0);
return promise.then<void>(() => void 0);
}
export function once<T>(event: Event<T>): Event<T> {
......
......@@ -460,7 +460,7 @@ class TypeScriptServiceClientHost implements ITypescriptServiceClientHost {
public goToProjectConfig(
isTypeScriptProject: boolean,
resource: Uri
): Thenable<TextEditor> | undefined {
): Thenable<TextEditor | undefined> | 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;
......
......@@ -30,7 +30,6 @@ export interface IDomEvent {
(element: EventHandler, type: 'MSPointerUp', useCapture?: boolean): _Event<MSPointerEvent>;
(element: EventHandler, type: 'abort', useCapture?: boolean): _Event<UIEvent>;
(element: EventHandler, type: 'activate', useCapture?: boolean): _Event<UIEvent>;
(element: EventHandler, type: 'ariarequest', useCapture?: boolean): _Event<AriaRequestEvent>;
(element: EventHandler, type: 'beforeactivate', useCapture?: boolean): _Event<UIEvent>;
(element: EventHandler, type: 'beforecopy', useCapture?: boolean): _Event<DragEvent>;
(element: EventHandler, type: 'beforecut', useCapture?: boolean): _Event<DragEvent>;
......@@ -41,7 +40,6 @@ export interface IDomEvent {
(element: EventHandler, type: 'canplaythrough', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'change', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'click', useCapture?: boolean): _Event<MouseEvent>;
(element: EventHandler, type: 'command', useCapture?: boolean): _Event<CommandEvent>;
(element: EventHandler, type: 'contextmenu', useCapture?: boolean): _Event<PointerEvent>;
(element: EventHandler, type: 'copy', useCapture?: boolean): _Event<DragEvent>;
(element: EventHandler, type: 'cuechange', useCapture?: boolean): _Event<Event>;
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册