From 076939f2e4acd56fba27d64b051826a20ec2a826 Mon Sep 17 00:00:00 2001 From: Matt Sherman Date: Wed, 18 Oct 2023 15:43:26 -0400 Subject: [PATCH] Ignore ts error about lack of types for @wordpress/data --- .../block-templates/src/utils/register-woo-block-type.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/js/block-templates/src/utils/register-woo-block-type.ts b/packages/js/block-templates/src/utils/register-woo-block-type.ts index 36add4f08d8..925d77b6a1f 100644 --- a/packages/js/block-templates/src/utils/register-woo-block-type.ts +++ b/packages/js/block-templates/src/utils/register-woo-block-type.ts @@ -7,10 +7,15 @@ import { BlockEditProps, registerBlockType, } from '@wordpress/blocks'; -import { useSelect, select as WPSelect } from '@wordpress/data'; import { createElement } from '@wordpress/element'; import { evaluate } from '@woocommerce/expression-evaluation'; import { ComponentType } from 'react'; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore No types for this exist yet, natively (not until 7.0.0). +// Including `@types/wordpress__data` as a devDependency causes build issues, +// so just going type-free for now. +// eslint-disable-next-line @woocommerce/dependency-group +import { useSelect, select as WPSelect } from '@wordpress/data'; interface BlockRepresentation< T extends Record< string, object > > { name?: string; @@ -41,7 +46,7 @@ function getEdit< const { getEvaluationContext } = useEvaluationContext( context ); const shouldHide = useSelect( - ( select ) => { + ( select: typeof WPSelect ) => { if ( ! hideConditions || ! Array.isArray( hideConditions ) ) { return false; }