mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-03 21:29:37 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user