Fix VSCode/Extensions for TS 2.3.1 (#25248)

From: https://github.com/Microsoft/TypeScript/issues/15352

TS 2.3.1 introduced a breaking change around checking of generic types. This change tries to fix these compiler errors in the extensions codebase
This commit is contained in:
Matt Bierner
2017-04-24 16:05:57 -07:00
committed by GitHub
parent fbfb925b4d
commit dc0f3ecdb2
8 changed files with 16 additions and 14 deletions

View File

@@ -117,13 +117,15 @@ export default class TypeScriptFormattingProvider implements DocumentRangeFormat
if (!absPath) {
return Promise.resolve(Object.create(null));
}
const formatOptions = this.getFormatOptions(options);
const args: Proto.ConfigureRequestArguments = {
file: absPath,
formatOptions: this.getFormatOptions(options)
formatOptions: formatOptions
};
return this.client.execute('configure', args, token).then(_ => {
this.formatOptions[key] = args.formatOptions;
return args.formatOptions;
this.formatOptions[key] = formatOptions;
return formatOptions;
});
}
}

View File

@@ -123,7 +123,7 @@ export function activate(context: ExtensionContext): void {
window.onDidChangeActiveTextEditor(VersionStatus.showHideStatus, null, context.subscriptions);
client.onReady().then(() => {
context.subscriptions.push(ProjectStatus.create(client,
path => new Promise(resolve => setTimeout(() => resolve(clientHost.handles(path)), 750)),
path => new Promise<boolean>(resolve => setTimeout(() => resolve(clientHost.handles(path)), 750)),
context.workspaceState));
}, () => {
// Nothing to do here. The client did show a message;

View File

@@ -686,7 +686,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
if (localModulePath) {
tryShowRestart(localModulePath);
}
return localModulePath;
return localModulePath || '';
});
case MessageAction.useBundled:
return this.workspaceState.update(TypeScriptServiceClient.useWorkspaceTsdkStorageKey, false)

View File

@@ -13,7 +13,7 @@ export class Delayer<T> {
public defaultDelay: number;
private timeout: any; // Timer
private completionPromise: Promise<T> | null;
private completionPromise: Promise<T | null> | null;
private onSuccess: ((value?: T | Thenable<T>) => void) | null;
private task: ITask<T> | null;
@@ -25,7 +25,7 @@ export class Delayer<T> {
this.task = null;
}
public trigger(task: ITask<T>, delay: number = this.defaultDelay): Promise<T> {
public trigger(task: ITask<T>, delay: number = this.defaultDelay): Promise<T | null> {
this.task = task;
if (delay >= 0) {
this.cancelTimeout();
@@ -55,7 +55,7 @@ export class Delayer<T> {
return this.completionPromise;
}
public forceDelivery(): Promise<T> | null {
public forceDelivery(): Promise<T | null> | null {
if (!this.completionPromise) {
return null;
}