diff --git a/src/data/moves/move.ts b/src/data/moves/move.ts index 5a22b352e73..36cef4d5e4e 100644 --- a/src/data/moves/move.ts +++ b/src/data/moves/move.ts @@ -93,6 +93,7 @@ import { getEnumValues } from "#utils/enums"; import { toCamelCase, toTitleCase } from "#utils/strings"; import i18next from "i18next"; import { applyChallenges } from "#utils/challenge-utils"; +import type { AbstractConstructor } from "#types/type-helpers"; /** * A function used to conditionally determine execution of a given {@linkcode MoveAttr}. @@ -1055,16 +1056,11 @@ export class SelfStatusMove extends 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]; -}; +type SubMove = AbstractConstructor function ChargeMove(Base: TBase, nameAppend: string) { - return class extends Base { + // NB: This cannot be made into a oneline return + abstract class Charging extends Base { /** The animation to play during the move's charging phase */ public readonly chargeAnim: ChargeAnim = ChargeAnim[`${MoveId[this.id]}_CHARGING`]; /** The message to show during the move's charging phase */ @@ -1141,6 +1137,7 @@ function ChargeMove(Base: TBase, nameAppend: string) { return this; } }; + return Charging; } export class ChargingAttackMove extends ChargeMove(AttackMove, "ChargingAttackMove") {}