Skip to content

Commit 7c1b34a

Browse files
authored
Remove any type and make removeEdgesAndNodes generic (#1353)
1 parent 7fd9ad8 commit 7c1b34a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: lib/shopify/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export async function shopifyFetch<T>({
114114
}
115115
}
116116

117-
const removeEdgesAndNodes = (array: Connection<any>) => {
117+
const removeEdgesAndNodes = <T>(array: Connection<T>): T[] => {
118118
return array.edges.map((edge) => edge?.node);
119119
};
120120

@@ -163,7 +163,7 @@ const reshapeImages = (images: Connection<Image>, productTitle: string) => {
163163
const flattened = removeEdgesAndNodes(images);
164164

165165
return flattened.map((image) => {
166-
const filename = image.url.match(/.*\/(.*)\..*/)[1];
166+
const filename = image.url.match(/.*\/(.*)\..*/)?.[1];
167167
return {
168168
...image,
169169
altText: image.altText || `${productTitle} - ${filename}`

0 commit comments

Comments
 (0)