Fixes some typedef errors (https://github.com/woocommerce/woocommerce-blocks/pull/1832)
This commit is contained in:
parent
69ea94378b
commit
6b110d00f2
|
@ -1,4 +1,4 @@
|
||||||
/** @typedef { import('@woocommerce/type-defs/hooks').StoreCartItems } StoreCartItems */
|
/** @typedef { import('@woocommerce/type-defs/hooks').StoreCartItem } StoreCartItem */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* External dependencies
|
* External dependencies
|
||||||
|
@ -14,10 +14,11 @@ import { useStoreCart } from './use-store-cart';
|
||||||
/**
|
/**
|
||||||
* This is a custom hook for loading the Store API /cart/ endpoint and
|
* This is a custom hook for loading the Store API /cart/ endpoint and
|
||||||
* actions for removing or changing item quantity.
|
* actions for removing or changing item quantity.
|
||||||
* See also: https://github.com/woocommerce/woocommerce-gutenberg-products-block/tree/master/src/RestApi/StoreApi
|
*
|
||||||
|
* @see https://github.com/woocommerce/woocommerce-gutenberg-products-block/tree/master/src/RestApi/StoreApi
|
||||||
*
|
*
|
||||||
* @param {string} cartItemKey Key for a cart item.
|
* @param {string} cartItemKey Key for a cart item.
|
||||||
* @return {StoreCartItems} An object exposing data and actions relating to cart items.
|
* @return {StoreCartItem} An object exposing data and actions relating to cart items.
|
||||||
*/
|
*/
|
||||||
export const useStoreCartItem = ( cartItemKey ) => {
|
export const useStoreCartItem = ( cartItemKey ) => {
|
||||||
const { cartItems, cartIsLoading } = useStoreCart();
|
const { cartItems, cartIsLoading } = useStoreCart();
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
/**
|
||||||
|
* @typedef {import('./cart').CartData} CartData
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} StoreCart
|
* @typedef {Object} StoreCart
|
||||||
*
|
*
|
||||||
|
@ -24,14 +28,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} StoreCartItems
|
* @typedef {Object} StoreCartItem
|
||||||
*
|
*
|
||||||
* @property {boolean} isLoading True when cart items are being loaded.
|
* @property {boolean} isLoading True when cart items are being
|
||||||
* @property {Array} cartItems An array of items in the cart.
|
* loaded.
|
||||||
* @property {Function} isItemQuantityPending Callback for determining if a cart item
|
* @property {CartData} cartData A cart item from the data store.
|
||||||
* is currently updating (i.e. remoe / change
|
* @property {Function} isPending Callback for determining if a cart
|
||||||
* quantity).
|
* item is currently updating (i.e.
|
||||||
* @property {Function} removeItemFromCart Callback for removing a cart item.
|
* remove / change quantity).
|
||||||
|
* @property {Function} removeItem Callback for removing a cart item.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export {};
|
export {};
|
||||||
|
|
Loading…
Reference in New Issue