Skip to content

Commit 79cfc6f

Browse files
test(css): type-safe cast in non-rule declarations/childRules test
The reader accessors `declarations` / `childRules` are typed on rule nodes; cast the function component value through the rule type so `tsconfig.types.test` type-checks the null-read assertion.
1 parent adf6548 commit 79cfc6f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

test/CssSyntax.unittest.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,9 @@ describe("CssSyntax — component values (tokenToNode)", () => {
300300
it("reads declarations / childRules as null on non-rule nodes", () => {
301301
// Only rules populate the decl / child-rule slots; a function (or any
302302
// non-rule container) has no entry and must read back `null`.
303-
const fn = parseAComponentValue("calc(1 + 2)");
303+
const fn = /** @type {import("../lib/css/syntax").QualifiedRule} */ (
304+
/** @type {unknown} */ (parseAComponentValue("calc(1 + 2)"))
305+
);
304306
expect(fn.declarations).toBeNull();
305307
expect(fn.childRules).toBeNull();
306308
});

0 commit comments

Comments
 (0)