fix: immutable extractNodes

This commit is contained in:
2026-01-21 21:58:35 -05:00
parent fd61895bbd
commit baa3061685

View File

@@ -1,4 +1,4 @@
// Helper: Extracts nodes from a GraphQL connection object, returning an empty array if nodes are absent. // Helper: Extracts nodes from a GraphQL connection object, returning an empty array if nodes are absent.
export function extractNodes<T>(connection: { nodes?: T[] } | null | undefined): T[] { export function extractNodes<T>(connection: { nodes?: readonly T[] } | null | undefined): readonly T[] {
return connection?.nodes || [] as T[]; return connection?.nodes ?? [];
} }