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:
parent
9960ea96cf
commit
c74a1fca00
3 changed files with 10 additions and 5 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue