aboutsummaryrefslogtreecommitdiffstats
path: root/language-web/src/main/js/editor/xtextMessages.ts
diff options
context:
space:
mode:
Diffstat (limited to 'language-web/src/main/js/editor/xtextMessages.ts')
-rw-r--r--language-web/src/main/js/editor/xtextMessages.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/language-web/src/main/js/editor/xtextMessages.ts b/language-web/src/main/js/editor/xtextMessages.ts
index d3cb9425..be3125e6 100644
--- a/language-web/src/main/js/editor/xtextMessages.ts
+++ b/language-web/src/main/js/editor/xtextMessages.ts
@@ -12,7 +12,8 @@ export interface IXtextWebOkResponse {
12 12
13export function isOkResponse(response: unknown): response is IXtextWebOkResponse { 13export function isOkResponse(response: unknown): response is IXtextWebOkResponse {
14 const okResponse = response as IXtextWebOkResponse; 14 const okResponse = response as IXtextWebOkResponse;
15 return typeof okResponse.id === 'string' 15 return typeof okResponse === 'object'
16 && typeof okResponse.id === 'string'
16 && typeof okResponse.response !== 'undefined'; 17 && typeof okResponse.response !== 'undefined';
17} 18}
18 19
@@ -30,7 +31,8 @@ export interface IXtextWebErrorResponse {
30 31
31export function isErrorResponse(response: unknown): response is IXtextWebErrorResponse { 32export function isErrorResponse(response: unknown): response is IXtextWebErrorResponse {
32 const errorResponse = response as IXtextWebErrorResponse; 33 const errorResponse = response as IXtextWebErrorResponse;
33 return typeof errorResponse.id === 'string' 34 return typeof errorResponse === 'object'
35 && typeof errorResponse.id === 'string'
34 && typeof errorResponse.error === 'string' 36 && typeof errorResponse.error === 'string'
35 && VALID_XTEXT_WEB_ERROR_KINDS.includes(errorResponse.error) 37 && VALID_XTEXT_WEB_ERROR_KINDS.includes(errorResponse.error)
36 && typeof errorResponse.message === 'string'; 38 && typeof errorResponse.message === 'string';
@@ -48,7 +50,8 @@ export interface IXtextWebPushMessage {
48 50
49export function isPushMessage(response: unknown): response is IXtextWebPushMessage { 51export function isPushMessage(response: unknown): response is IXtextWebPushMessage {
50 const pushMessage = response as IXtextWebPushMessage; 52 const pushMessage = response as IXtextWebPushMessage;
51 return typeof pushMessage.resource === 'string' 53 return typeof pushMessage === 'object'
54 && typeof pushMessage.resource === 'string'
52 && typeof pushMessage.stateId === 'string' 55 && typeof pushMessage.stateId === 'string'
53 && typeof pushMessage.service === 'string' 56 && typeof pushMessage.service === 'string'
54 && typeof pushMessage.push !== 'undefined'; 57 && typeof pushMessage.push !== 'undefined';