refactor(modifiers): remove double-casts in registry and schema

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
Joey Yakimowich-Payne 2026-04-19 14:00:10 -06:00
commit c74a1fca00
No known key found for this signature in database
3 changed files with 10 additions and 5 deletions

View file

@ -43,10 +43,10 @@ class ModifierRegistryClass {
`Each modifier descriptor must have a unique id.`,
);
}
// Widen to the internal unknown-typed representation. The double-cast
// through `unknown` is intentional: the registry is a heterogeneous
// store and V is intentionally erased at storage time.
this.#byId.set(descriptor.id, descriptor as unknown as ModifierDescriptor);
// `ModifierDescriptor<V>` is not structurally assignable to
// `ModifierDescriptor<unknown>` due function-parameter variance.
// Erase V once at registry storage boundary.
this.#byId.set(descriptor.id, descriptor as ModifierDescriptor);
}
/**

View file

@ -85,7 +85,7 @@ export const ModifierProfileSchema = z.object({
/** Parse an unknown value as a ModifierProfile. Throws ZodError on failure. */
export function parseModifierProfile(raw: unknown): ModifierProfile {
return ModifierProfileSchema.parse(raw) as unknown as ModifierProfile;
return ModifierProfileSchema.parse(raw) as ModifierProfile;
}
/** Serialize a ModifierProfile to a JSON-safe plain object. */