From 5f1a9f788f3c691956991e8212a24e08f9625f3c Mon Sep 17 00:00:00 2001 From: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Date: Mon, 9 Jun 2025 13:03:35 -0500 Subject: [PATCH] Ensure ChargeMove's is method calls super --- src/data/moves/move.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/data/moves/move.ts b/src/data/moves/move.ts index ff963414d4b..4b6c805f1aa 100644 --- a/src/data/moves/move.ts +++ b/src/data/moves/move.ts @@ -1045,7 +1045,13 @@ export class SelfStatusMove extends Move { } } -type SubMove = new (...args: any[]) => Move; +// TODO: Figure out how to improve the signature of this so that +// the `ChargeMove` function knows that the argument `Base` is a specific subclass of move that cannot +// be abstract. +// Right now, I only know how to do this by using the type conjunction (the & operators) +type SubMove = new (...args: any[]) => Move & { + is(moveKind: K): this is MoveClassMap[K]; +}; function ChargeMove(Base: TBase, nameAppend: string) { return class extends Base { @@ -1063,7 +1069,7 @@ function ChargeMove(Base: TBase, nameAppend: string) { override is(moveKind: K): this is MoveClassMap[K] { // Anything subclassing this is a charge move. - return moveKind === "ChargeMove" || moveKind === nameAppend; + return moveKind === "ChargeMove" || moveKind === nameAppend || super.is(moveKind); } /**