Make NoContentResponse an constant instead of a class

This commit is contained in:
Matt Bierner
2019-01-10 16:34:20 -08:00
parent 60f232b246
commit 2f5d88899d
2 changed files with 3 additions and 5 deletions

View File

@@ -301,7 +301,7 @@ export class TypeScriptServer extends Disposable {
callback.onSuccess(response);
} else if (response.message === 'No content available.') {
// Special case where response itself is successful but there is not any data to return.
callback.onSuccess(new NoContentResponse());
callback.onSuccess(NoContentResponse);
} else {
callback.onError(new TypeScriptServerError(this._version, response));
}

View File

@@ -19,11 +19,9 @@ export class CancelledResponse {
) { }
}
export class NoContentResponse {
public readonly type: 'noContent' = 'noContent';
}
export const NoContentResponse = new class { readonly type = 'noContent'; };
export type ServerResponse<T extends Proto.Response> = T | CancelledResponse | NoContentResponse;
export type ServerResponse<T extends Proto.Response> = T | CancelledResponse | typeof NoContentResponse;
interface TypeScriptRequestTypes {
'applyCodeActionCommand': [Proto.ApplyCodeActionCommandRequestArgs, Proto.ApplyCodeActionCommandResponse];