Use type-guard
This commit is contained in:
@@ -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 {MappingToken} from "@github/actions-workflow-parser/templates/tokens/mapping-token";
|
||||||
import {SequenceToken} from "@github/actions-workflow-parser/templates/tokens/sequence-token";
|
import {SequenceToken} from "@github/actions-workflow-parser/templates/tokens/sequence-token";
|
||||||
import {TokenType} from "@github/actions-workflow-parser/templates/tokens/types";
|
import {TokenType} from "@github/actions-workflow-parser/templates/tokens/types";
|
||||||
@@ -165,9 +166,8 @@ function emptyNode(token: TemplateToken | null): boolean {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (token.templateTokenType === TokenType.String) {
|
if (isString(token)) {
|
||||||
const stringToken = token as StringToken;
|
return token.value === "";
|
||||||
return stringToken.value === "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user