[Refactor] `setTypeIcons` explicitly handles `null`, mark it as such (#4155)

This commit is contained in:
NightKev 2024-09-11 17:59:57 -07:00 committed by GitHub
parent d4cd74c8b7
commit fec218b747
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 10 deletions

View File

@ -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());