From 285ed7c3db2c42a6ecaa9ef4dbf6f1d01e7ad63b Mon Sep 17 00:00:00 2001 From: Christopher Schleiden Date: Thu, 17 Nov 2022 11:25:40 -0800 Subject: [PATCH] Use type-guard --- actions-languageservice/src/utils/find-token.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/actions-languageservice/src/utils/find-token.ts b/actions-languageservice/src/utils/find-token.ts index 4a7c8bf..88e43ee 100644 --- a/actions-languageservice/src/utils/find-token.ts +++ b/actions-languageservice/src/utils/find-token.ts @@ -1,4 +1,5 @@ -import {StringToken, TemplateToken} from "@github/actions-workflow-parser/templates/tokens/index"; +import {isString} from "@github/actions-workflow-parser"; +import {TemplateToken} from "@github/actions-workflow-parser/templates/tokens/index"; import {MappingToken} from "@github/actions-workflow-parser/templates/tokens/mapping-token"; import {SequenceToken} from "@github/actions-workflow-parser/templates/tokens/sequence-token"; import {TokenType} from "@github/actions-workflow-parser/templates/tokens/types"; @@ -165,9 +166,8 @@ function emptyNode(token: TemplateToken | null): boolean { return true; } - if (token.templateTokenType === TokenType.String) { - const stringToken = token as StringToken; - return stringToken.value === ""; + if (isString(token)) { + return token.value === ""; } return false;