diff options
Diffstat (limited to 'language-web/src/main/js/editor/xtextServiceResults.ts')
-rw-r--r-- | language-web/src/main/js/editor/xtextServiceResults.ts | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/language-web/src/main/js/editor/xtextServiceResults.ts b/language-web/src/main/js/editor/xtextServiceResults.ts index 8fa7a321..8a4afa40 100644 --- a/language-web/src/main/js/editor/xtextServiceResults.ts +++ b/language-web/src/main/js/editor/xtextServiceResults.ts | |||
@@ -4,7 +4,8 @@ export interface IPongResult { | |||
4 | 4 | ||
5 | export function isPongResult(result: unknown): result is IPongResult { | 5 | export function isPongResult(result: unknown): result is IPongResult { |
6 | const pongResult = result as IPongResult; | 6 | const pongResult = result as IPongResult; |
7 | return typeof pongResult.pong === 'string'; | 7 | return typeof pongResult === 'object' |
8 | && typeof pongResult.pong === 'string'; | ||
8 | } | 9 | } |
9 | 10 | ||
10 | export interface IDocumentStateResult { | 11 | export interface IDocumentStateResult { |
@@ -13,7 +14,8 @@ export interface IDocumentStateResult { | |||
13 | 14 | ||
14 | export function isDocumentStateResult(result: unknown): result is IDocumentStateResult { | 15 | export function isDocumentStateResult(result: unknown): result is IDocumentStateResult { |
15 | const documentStateResult = result as IDocumentStateResult; | 16 | const documentStateResult = result as IDocumentStateResult; |
16 | return typeof documentStateResult.stateId === 'string'; | 17 | return typeof documentStateResult === 'object' |
18 | && typeof documentStateResult.stateId === 'string'; | ||
17 | } | 19 | } |
18 | 20 | ||
19 | export const VALID_CONFLICTS = ['invalidStateId', 'canceled'] as const; | 21 | export const VALID_CONFLICTS = ['invalidStateId', 'canceled'] as const; |
@@ -50,7 +52,8 @@ export interface IIssue { | |||
50 | 52 | ||
51 | export function isIssue(value: unknown): value is IIssue { | 53 | export function isIssue(value: unknown): value is IIssue { |
52 | const issue = value as IIssue; | 54 | const issue = value as IIssue; |
53 | return typeof issue.description === 'string' | 55 | return typeof issue === 'object' |
56 | && typeof issue.description === 'string' | ||
54 | && typeof issue.severity === 'string' | 57 | && typeof issue.severity === 'string' |
55 | && VALID_SEVERITIES.includes(issue.severity) | 58 | && VALID_SEVERITIES.includes(issue.severity) |
56 | && typeof issue.line === 'number' | 59 | && typeof issue.line === 'number' |
@@ -65,6 +68,7 @@ export interface IValidationResult { | |||
65 | 68 | ||
66 | export function isValidationResult(result: unknown): result is IValidationResult { | 69 | export function isValidationResult(result: unknown): result is IValidationResult { |
67 | const validationResult = result as IValidationResult; | 70 | const validationResult = result as IValidationResult; |
68 | return Array.isArray(validationResult.issues) | 71 | return typeof validationResult === 'object' |
72 | && Array.isArray(validationResult.issues) | ||
69 | && validationResult.issues.every(isIssue); | 73 | && validationResult.issues.every(isIssue); |
70 | } | 74 | } |