Fix missing union types for phaseName

This commit is contained in:
Sirz Benjie 2025-05-22 19:18:22 -05:00
parent 86b59a0243
commit a5721a76be
No known key found for this signature in database
GPG Key ID: 4A524B4D196C759E
5 changed files with 9 additions and 7 deletions

View File

@ -47,7 +47,8 @@ import { WEIGHT_INCREMENT_ON_SPAWN_MISS } from "#app/data/mystery-encounters/mys
import { getNatureName } from "#app/data/nature";
export class EncounterPhase extends BattlePhase {
protected readonly phaseName = "EncounterPhase";
// Union type is necessary as these
protected readonly phaseName: "EncounterPhase" | "NextEncounterPhase" | "NewBiomeEncounterPhase" = "EncounterPhase";
private loaded: boolean;
constructor(loaded = false) {

View File

@ -7,7 +7,8 @@ import { BattlePhase } from "./battle-phase";
export class ModifierRewardPhase extends BattlePhase {
// RibbonModifierRewardPhase extends ModifierRewardPhase and to make typescript happy
// we need to use a union type here
protected readonly phaseName: "ModifierRewardPhase" | "RibbonModifierRewardPhase" = "ModifierRewardPhase";
protected readonly phaseName: "ModifierRewardPhase" | "RibbonModifierRewardPhase" | "GameOverModifierRewardPhase" =
"ModifierRewardPhase";
protected modifierType: ModifierType;
constructor(modifierTypeFunc: ModifierTypeFunc) {

View File

@ -6,7 +6,7 @@ import { EncounterPhase } from "./encounter-phase";
* Handles generating, loading and preparing for it.
*/
export class NextEncounterPhase extends EncounterPhase {
protected readonly phaseName = "NextEncounterPhase";
protected readonly phaseName: "NextEncounterPhase" | "NewBiomeEncounterPhase" = "NextEncounterPhase";
start() {
super.start();
}

View File

@ -17,9 +17,9 @@ import { applyPreSummonAbAttrs, PreSummonAbAttr } from "#app/data/abilities/abil
import { globalScene } from "#app/global-scene";
export class SummonPhase extends PartyMemberPokemonPhase {
// Both SwitchSummonPhase and SummonMissingPhase extend this class and so we must use a
// union type to make typescript happy.
protected readonly phaseName: "SummonPhase" | "SummonMissingPhase" | "SwitchSummonPhase" = "SummonPhase";
// The union type is needed to keep typescript happy as these phases extend from SummonPhase
protected readonly phaseName: "SummonPhase" | "SummonMissingPhase" | "SwitchSummonPhase" | "ReturnPhase" =
"SummonPhase";
private loaded: boolean;
constructor(fieldIndex: number, player = true, loaded = false) {

View File

@ -22,7 +22,7 @@ import { SubstituteTag } from "#app/data/battler-tags";
import { SwitchType } from "#enums/switch-type";
export class SwitchSummonPhase extends SummonPhase {
protected readonly phaseName = "SwitchSummonPhase";
protected readonly phaseName: "SwitchSummonPhase" | "ReturnPhase" = "SwitchSummonPhase";
private readonly switchType: SwitchType;
private readonly slotIndex: number;
private readonly doReturn: boolean;