Skip to content

Commit ebcb555

Browse files
committed
fix: Remove unnecessary type guard named isBooleanAttr.
1 parent 2615eb9 commit ebcb555

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

packages/@css-blocks/core/src/Analyzer/ElementAnalysis.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ export interface HasAttrValue<T extends Style = Style> {
4141
value: Set<T>;
4242
}
4343

44-
export function isBooleanAttr(o: object): o is HasAttrValue | SerializedHasAttrValue {
45-
return hasAttrValue(o);
46-
}
47-
4844
export function hasAttrValue(o: object): o is HasAttrValue | SerializedHasAttrValue {
4945
if (!("value" in o)) return false;
5046
let value = (<HasAttrValue | SerializedHasAttrValue>o).value;
@@ -456,7 +452,7 @@ export class ElementAnalysis<BooleanExpression, StringExpression, TernaryExpress
456452
stringExpression: style.stringExpression,
457453
};
458454
}
459-
else if (isBooleanAttr(style) && style.value.has(cond)) {
455+
else if (hasAttrValue(style) && style.value.has(cond)) {
460456
return isConditional(style) ? { condition: style.condition } : true;
461457
}
462458
}

packages/@css-blocks/core/src/Analyzer/validations/property-conflict-validator.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import { AttrValue, BlockClass, Ruleset, Style, isBlockClass } from "../../Block
66
import { charInFile } from "../../errors";
77
import {
88
ElementAnalysis,
9+
hasAttrValue,
910
isAttrGroup,
10-
isBooleanAttr,
1111
isFalseCondition,
1212
isTrueCondition,
1313
} from "../ElementAnalysis";
@@ -216,7 +216,7 @@ export const propertyConflictValidator: Validator = (elAnalysis, _templateAnalys
216216
allConditions.setAll(attrConditions);
217217
}
218218

219-
else if (isBooleanAttr(condition)) {
219+
else if (hasAttrValue(condition)) {
220220
for (let val of condition.value) {
221221
evaluate(val as AttrValue, allConditions, conflicts);
222222
add(allConditions, val as AttrValue);

0 commit comments

Comments
 (0)