fix: immutable extractNodes
This commit is contained in:
@@ -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 ?? [];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user