Shopify / shopify-app-template-node

MIT License
867 stars 391 forks source link

Type Error/warning: Type deliveryMethod... is not assignable to type 'WebhookHandlersParam'. #1262

Closed ConnorIngold closed 1 year ago

ConnorIngold commented 1 year ago

Issue summary

After running, npm create @shopify/app and looking at the index.js file in VSCode it picks up a type error.

image

 shopify.processWebhooks({ webhookHandlers: GDPRWebhookHandlers.CUSTOMERS_DATA_REQUEST })

The full type error is:

Type '{ deliveryMethod: DeliveryMethod; callbackUrl: string; callback: (topic: any, shop: any, body: any, webhookId: any) => Promise<void>; }' is not assignable to type 'WebhookHandlersParam'.
  Property 'deliveryMethod' is incompatible with index signature.
    Type 'import("s:/projects/product-installer-plus/product-installer-plus/web/node_modules/@shopify/shopify-api/lib/webhooks/types").DeliveryMethod' is not assignable to type 'WebhookHandler | WebhookHandler[]'.ts(2322)

Basically, Type '{ deliveryMethod: DeliveryMethod; callbackUrl: string; callback: (topic: any, shop: any, body: any, webhookId: any) => Promise; }' is not assignable to type 'WebhookHandlersParam'.

Expected behavior

Not to see any type errors upon generating the app even with the // @ts-check comment.

Actual behavior

Highlighted type errors in VSCode.

Steps to reproduce the problem

Run npm create @shopify/app and open index.js