Skip to content

Commit

Permalink
fix: tag return type
Browse files Browse the repository at this point in the history
  • Loading branch information
chase-moskal committed Jul 13, 2023
1 parent f8f9971 commit 23972ca
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions s/shopify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ export class Shopify {
return new this(new Remote(settings))
}

static async all<T>(generator: AsyncGenerator<T[]>) {
const all: T[][] = []
static async all<Y>(generator: AsyncGenerator<Y[]>) {
const all: Y[][] = []

for await (const items of generator)
all.push(items)

return all.flat()
}

Expand Down Expand Up @@ -81,7 +83,7 @@ export class Shopify {
page_size = default_page_size,
}: {
page_size?: number
} = {}) {
} = {}): AsyncGenerator<string[]> {

const result = await this.remote.request<GqlTags>(
make_request_for_tags({page_size})
Expand Down Expand Up @@ -134,6 +136,7 @@ export class Shopify {
async everything() {
return concurrent({
shop: this.shop(),
tags: Shopify.all(this.tags()),
products: Shopify.all(this.products()),
collections: Shopify.all(this.collections()),
})
Expand Down

0 comments on commit 23972ca

Please sign in to comment.