From fec218b747ba7fd685d9dbd54d381884c2743c31 Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Wed, 11 Sep 2024 17:59:57 -0700 Subject: [PATCH] [Refactor] `setTypeIcons` explicitly handles `null`, mark it as such (#4155) --- src/ui/starter-select-ui-handler.ts | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index 0c3d8de61b0..d99c25bc612 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -28,15 +28,15 @@ import { Mode } from "./ui"; import { addWindow } from "./ui-theme"; import { Egg } from "#app/data/egg"; import Overrides from "#app/overrides"; -import {SettingKeyboard} from "#app/system/settings/settings-keyboard"; -import {Passive as PassiveAttr} from "#enums/passive"; +import { SettingKeyboard } from "#app/system/settings/settings-keyboard"; +import { Passive as PassiveAttr } from "#enums/passive"; import * as Challenge from "../data/challenge"; import MoveInfoOverlay from "./move-info-overlay"; import { getEggTierForSpecies } from "#app/data/egg"; import { Device } from "#enums/devices"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; -import {Button} from "#enums/buttons"; +import { Button } from "#enums/buttons"; import { EggSourceType } from "#app/enums/egg-source-types"; import AwaitableUiHandler from "./awaitable-ui-handler"; import { DropDown, DropDownLabel, DropDownOption, DropDownState, DropDownType, SortCriteria } from "./dropdown"; @@ -2905,7 +2905,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { } const speciesForm = getPokemonSpeciesForm(species.speciesId, props.formIndex); - this.setTypeIcons(speciesForm.type1, speciesForm!.type2!); // TODO: are those bangs correct? + this.setTypeIcons(speciesForm.type1, speciesForm.type2); this.pokemonSprite.clearTint(); if (this.pokerusSpecies.includes(species)) { @@ -3242,13 +3242,12 @@ export default class StarterSelectUiHandler extends MessageUiHandler { this.pokemonFormText.setText(formText ? i18next.t(`pokemonForm:${speciesName}${formText}`) : ""); } - this.setTypeIcons(speciesForm.type1, speciesForm.type2!); // TODO: is this bang correct? + this.setTypeIcons(speciesForm.type1, speciesForm.type2); } else { this.pokemonAbilityText.setText(""); this.pokemonPassiveText.setText(""); this.pokemonNatureText.setText(""); - // @ts-ignore - this.setTypeIcons(null, null); // TODO: resolve ts-ignore.. huh!? + this.setTypeIcons(null, null); } } else { this.shinyOverlay.setVisible(false); @@ -3258,8 +3257,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { this.pokemonAbilityText.setText(""); this.pokemonPassiveText.setText(""); this.pokemonNatureText.setText(""); - // @ts-ignore - this.setTypeIcons(null, null); // TODO: resolve ts-ignore.. huh!? + this.setTypeIcons(null, null); } if (!this.starterMoveset) { @@ -3292,7 +3290,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { this.updateInstructions(); } - setTypeIcons(type1: Type, type2: Type): void { + setTypeIcons(type1: Type | null, type2: Type | null): void { if (type1 !== null) { this.type1Icon.setVisible(true); this.type1Icon.setFrame(Type[type1].toLowerCase());