From c09e97a5612f0fe33dfdc1d0bc27ca0dae58f634 Mon Sep 17 00:00:00 2001 From: Leslie Fernando Date: Sun, 5 Oct 2025 17:14:34 +0530 Subject: [PATCH] =?UTF-8?q?Improve=20type=20safety:=20Replace=20'any[]'=20?= =?UTF-8?q?with=20generic=20type=20parameter=20in=20a=E2=80=A6=20(#27334)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Improve type safety: Replace 'any[]' with generic type parameter in arrayFilter function - Convert arrayFilter from using 'any[]' to generic type - Improves TypeScript type safety and inference - Follows strict TypeScript guidelines in codebase - No behavioral changes, purely type improvement --- src/panels/lovelace/common/find-entities.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/panels/lovelace/common/find-entities.ts b/src/panels/lovelace/common/find-entities.ts index 8901ba4bb1..145023edde 100644 --- a/src/panels/lovelace/common/find-entities.ts +++ b/src/panels/lovelace/common/find-entities.ts @@ -2,16 +2,16 @@ import type { HassEntity } from "home-assistant-js-websocket"; import { computeDomain } from "../../../common/entity/compute_domain"; import type { HomeAssistant } from "../../../types"; -const arrayFilter = ( - array: any[], - conditions: ((value: any) => boolean)[], +const arrayFilter = ( + array: T[], + conditions: ((value: T) => boolean)[], maxSize: number -) => { +): T[] => { if (!maxSize || maxSize > array.length) { maxSize = array.length; } - const filteredArray: any[] = []; + const filteredArray: T[] = []; for (let i = 0; i < array.length && filteredArray.length < maxSize; i++) { let meetsConditions = true;