From 264322237311888c63030cd17fcd0a7e519a99f5 Mon Sep 17 00:00:00 2001 From: Joey Yakimowich-Payne Date: Sun, 19 Apr 2026 16:49:50 -0600 Subject: [PATCH] refactor(rete): use asEntityId for AGG_FACT sentinel id Drop the `-1 as unknown as EntityId` double-cast in favour of the asEntityId() helper exported alongside the type. Single-site, documented cast instead of an inline double-cast. Completes the cleanup of `as unknown as` in non-test source across both packages/chess and packages/rete. --- packages/rete/src/aggregate.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/rete/src/aggregate.ts b/packages/rete/src/aggregate.ts index 13dc449..f4fd220 100644 --- a/packages/rete/src/aggregate.ts +++ b/packages/rete/src/aggregate.ts @@ -62,7 +62,7 @@ * ExistentialNode upstream. */ import { Token, type Bindings } from "./beta.js"; -import type { EntityId } from "./schema.js"; +import { asEntityId } from "./schema.js"; import type { AttrKey, FactValue } from "./wm.js"; /** Supported aggregator kinds. Extending this list requires a new case in @@ -85,7 +85,7 @@ type DeactivateListener = (token: Token) => void; * `schema.ts`), so there is no risk of collision. */ const AGG_FACT = { - id: -1 as unknown as EntityId, + id: asEntityId(-1), attr: "__agg__" as AttrKey, value: null as FactValue, } as const;