Avoid using as to cast values (#1115)

## Description:

- Use `<argument> is <type>` return type declarations in favor of `as`.
- Use `satisfies` instead of `as`.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

---------

Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
This commit is contained in:
Scott Anderson
2025-06-10 00:59:31 -04:00
committed by GitHub
parent a19bfec40a
commit cfbed15fad
4 changed files with 19 additions and 15 deletions
+3 -1
View File
@@ -120,7 +120,9 @@ export class BotBehavior {
// Prefer neighboring bots
const bots = this.player
.neighbors()
.filter((n) => n.isPlayer() && n.type() === PlayerType.Bot) as Player[];
.filter(
(n): n is Player => n.isPlayer() && n.type() === PlayerType.Bot,
);
if (bots.length > 0) {
const density = (p: Player) => p.troops() / p.numTilesOwned();
let lowestDensityBot: Player | undefined;