Shopify / js-buy-sdk

The JS Buy SDK is a lightweight library that allows you to build ecommerce into any website. It is based on Shopify's API and provides the ability to retrieve products and collections from your shop, add products to a cart, and checkout.
https://shopify.github.io/js-buy-sdk
MIT License
984 stars 259 forks source link

Typescript error in expanding SDK #816

Open jsdevninja opened 3 years ago

jsdevninja commented 3 years ago

Bug details I have a typescript error when expanding the SDK in typescript.

Could not find a declaration file for module 'shopify-buy/index.unoptimized.umd'. '.../node_modules/shopify-buy/index.unoptimized.umd.js' implicitly has an 'any' type. If the 'shopify-buy' package actually exposes this module, consider sending a pull request to amend 'https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/shopify-buy` TS7016

import Client from 'shopify-buy/index.unoptimized.umd';

Any suggestions on how I can overcome this issue? Thanks.

isamu commented 3 years ago
/* eslint @typescript-eslint/no-var-requires: "off" */
const Client = require("shopify-buy/index.unoptimized.umd.js");
aureate-labs-team commented 3 years ago

Minor correction for reducing package size is to use the minified version of an unoptimized version...

/ eslint @typescript-eslint/no-var-requires: "off" / const Client = require("shopify-buy/index.unoptimized.umd.min.js");