Skip to content

Commit f69c457

Browse files
committed
fix: Allow null in typeguards.
1 parent 94d1ded commit f69c457

File tree

1 file changed

+16
-16
lines changed
  • packages/@css-blocks/glimmer/src

1 file changed

+16
-16
lines changed

packages/@css-blocks/glimmer/src/utils.ts

+16-16
Original file line numberDiff line numberDiff line change
@@ -44,48 +44,48 @@ export function cssBlockError(message: string, node: AST.Node, templatePath: str
4444
});
4545
}
4646

47-
export function isStringLiteral(value: AST.Node | undefined): value is AST.StringLiteral {
48-
return value !== undefined && value.type === "StringLiteral";
47+
export function isStringLiteral(value: AST.Node | undefined | null): value is AST.StringLiteral {
48+
return value !== undefined && value !== null && value.type === "StringLiteral";
4949
}
50-
export function isConcatStatement(value: AST.Node | undefined): value is AST.ConcatStatement {
50+
export function isConcatStatement(value: AST.Node | undefined | null): value is AST.ConcatStatement {
5151
return !!value && value.type === "ConcatStatement";
5252
}
53-
export function isTextNode(value: AST.Node | undefined): value is AST.TextNode {
53+
export function isTextNode(value: AST.Node | undefined | null): value is AST.TextNode {
5454
return !!value && value.type === "TextNode";
5555
}
56-
export function isBooleanLiteral(value: AST.Node | undefined): value is AST.BooleanLiteral {
56+
export function isBooleanLiteral(value: AST.Node | undefined | null): value is AST.BooleanLiteral {
5757
return !!value && value.type === "BooleanLiteral";
5858
}
59-
export function isMustacheStatement(value: AST.Node | undefined): value is AST.MustacheStatement {
59+
export function isMustacheStatement(value: AST.Node | undefined | null): value is AST.MustacheStatement {
6060
return !!value && value.type === "MustacheStatement";
6161
}
62-
export function isBlockStatement(value: AST.Node | undefined): value is AST.BlockStatement {
62+
export function isBlockStatement(value: AST.Node | undefined | null): value is AST.BlockStatement {
6363
return !!value && value.type === "BlockStatement";
6464
}
65-
export function isSubExpression(value: AST.Node | undefined): value is AST.SubExpression {
65+
export function isSubExpression(value: AST.Node | undefined | null): value is AST.SubExpression {
6666
return !!value && value.type === "SubExpression";
6767
}
68-
export function isElementNode(value: AST.Node | undefined): value is AST.ElementNode {
68+
export function isElementNode(value: AST.Node | undefined | null): value is AST.ElementNode {
6969
return !!value && value.type === "ElementNode";
7070
}
71-
export function isNumberLiteral(value: AST.Node | undefined): value is AST.NumberLiteral {
71+
export function isNumberLiteral(value: AST.Node | undefined | null): value is AST.NumberLiteral {
7272
return !!value && value.type === "NumberLiteral";
7373
}
74-
export function isNullLiteral(value: AST.Node | undefined): value is AST.NullLiteral {
74+
export function isNullLiteral(value: AST.Node | undefined | null): value is AST.NullLiteral {
7575
return !!value && value.type === "NullLiteral";
7676
}
77-
export function isUndefinedLiteral(value: AST.Node | undefined): value is AST.UndefinedLiteral {
77+
export function isUndefinedLiteral(value: AST.Node | undefined | null): value is AST.UndefinedLiteral {
7878
return !!value && value.type === "UndefinedLiteral";
7979
}
80-
export function isPathExpression(value: AST.Node | undefined): value is AST.PathExpression {
80+
export function isPathExpression(value: AST.Node | undefined | null): value is AST.PathExpression {
8181
return !!value && value.type === "PathExpression";
8282
}
83-
export function isHashPair(value: AST.Node | undefined): value is AST.HashPair {
83+
export function isHashPair(value: AST.Node | undefined | null): value is AST.HashPair {
8484
return !!value && value.type === "HashPair";
8585
}
86-
export function isAttrNode(value: AST.Node | undefined): value is AST.AttrNode {
86+
export function isAttrNode(value: AST.Node | undefined | null): value is AST.AttrNode {
8787
return !!value && value.type === "AttrNode";
8888
}
89-
export function isAnalyzableProperty(value: AST.Node | undefined): value is AnalyzableProperty {
89+
export function isAnalyzableProperty(value: AST.Node | undefined | null): value is AnalyzableProperty {
9090
return !!value && (isAttrNode(value) || isHashPair(value) || isPathExpression(value));
9191
}

0 commit comments

Comments
 (0)