Let IRPCProtocol#getProxy return Proxied<T> which enforces functions returning promises

fyi @sandy081 had to remove the overload of `MainThreadOutputServiceShape#$update` because I couldn't get this to work with mapped types

fyi @Tyriar this fixed an actual issue with terminals
This commit is contained in:
Johannes Rieken
2022-01-17 18:10:06 +01:00
parent 4aed6e1fd1
commit 393443eb40
8 changed files with 23 additions and 19 deletions

View File

@@ -196,7 +196,7 @@ export class ExtHostCommands implements ExtHostCommandsShape {
});
try {
const result = await this.#proxy.$executeCommand<T>(id, hasBuffers ? new SerializableObjectWithBuffers(toArgs) : toArgs, retry);
const result = await this.#proxy.$executeCommand(id, hasBuffers ? new SerializableObjectWithBuffers(toArgs) : toArgs, retry);
return revive<any>(result);
} catch (e) {
// Rerun the command when it wasn't known, had arguments, and when retry
@@ -211,7 +211,7 @@ export class ExtHostCommands implements ExtHostCommandsShape {
}
}
private async _executeContributedCommand<T>(id: string, args: any[], annotateError: boolean): Promise<T> {
private async _executeContributedCommand<T = unknown>(id: string, args: any[], annotateError: boolean): Promise<T> {
const command = this._commands.get(id);
if (!command) {
throw new Error('Unknown command');
@@ -254,7 +254,7 @@ export class ExtHostCommands implements ExtHostCommandsShape {
}
}
$executeContributedCommand<T>(id: string, ...args: any[]): Promise<T> {
$executeContributedCommand(id: string, ...args: any[]): Promise<unknown> {
this._logService.trace('ExtHostCommands#$executeContributedCommand', id);
if (!this._commands.has(id)) {