setTypeIcons explicitly handles null, mark it as such

This commit is contained in:
NightKev 2024-09-10 08:49:25 -07:00
parent 5bf21a4f75
commit 975bd92918

View File

@ -2895,7 +2895,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
} }
const speciesForm = getPokemonSpeciesForm(species.speciesId, props.formIndex); 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(); this.pokemonSprite.clearTint();
if (this.pokerusSpecies.includes(species)) { if (this.pokerusSpecies.includes(species)) {
@ -3232,13 +3232,12 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.pokemonFormText.setText(formText ? i18next.t(`pokemonForm:${speciesName}${formText}`) : ""); 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 { } else {
this.pokemonAbilityText.setText(""); this.pokemonAbilityText.setText("");
this.pokemonPassiveText.setText(""); this.pokemonPassiveText.setText("");
this.pokemonNatureText.setText(""); this.pokemonNatureText.setText("");
// @ts-ignore this.setTypeIcons(null, null);
this.setTypeIcons(null, null); // TODO: resolve ts-ignore.. huh!?
} }
} else { } else {
this.shinyOverlay.setVisible(false); this.shinyOverlay.setVisible(false);
@ -3248,8 +3247,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.pokemonAbilityText.setText(""); this.pokemonAbilityText.setText("");
this.pokemonPassiveText.setText(""); this.pokemonPassiveText.setText("");
this.pokemonNatureText.setText(""); this.pokemonNatureText.setText("");
// @ts-ignore this.setTypeIcons(null, null);
this.setTypeIcons(null, null); // TODO: resolve ts-ignore.. huh!?
} }
if (!this.starterMoveset) { if (!this.starterMoveset) {
@ -3282,7 +3280,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.updateInstructions(); this.updateInstructions();
} }
setTypeIcons(type1: Type, type2: Type): void { setTypeIcons(type1: Type | null, type2: Type | null): void {
if (type1 !== null) { if (type1 !== null) {
this.type1Icon.setVisible(true); this.type1Icon.setVisible(true);
this.type1Icon.setFrame(Type[type1].toLowerCase()); this.type1Icon.setFrame(Type[type1].toLowerCase());