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.
This commit is contained in:
Joey Yakimowich-Payne 2026-04-19 16:49:50 -06:00
commit 2643222373
No known key found for this signature in database

View file

@ -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;