From 90e7a4907252b94decaba2862ea393c57e71b619 Mon Sep 17 00:00:00 2001 From: ramon Date: Thu, 5 Dec 2024 05:59:57 +1100 Subject: [PATCH] Implementing feedback. Using `@ts-expect-error` instead of ignore, and fixing type assignment --- packages/edit-site/src/components/style-book/categories.ts | 7 ++++--- .../edit-site/src/components/style-book/color-examples.tsx | 5 ++--- packages/edit-site/src/components/style-book/examples.tsx | 7 ++----- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/packages/edit-site/src/components/style-book/categories.ts b/packages/edit-site/src/components/style-book/categories.ts index 821ed418583e9c..b36c211eaa546c 100644 --- a/packages/edit-site/src/components/style-book/categories.ts +++ b/packages/edit-site/src/components/style-book/categories.ts @@ -1,7 +1,8 @@ /** * WordPress dependencies */ -// @ts-ignore +// @wordpress/blocks imports are not typed. +// @ts-expect-error import { getCategories } from '@wordpress/blocks'; /** @@ -30,11 +31,11 @@ export function getExamplesByCategory( if ( ! categoryDefinition?.slug || ! examples?.length ) { return; } - const categories: StyleBookCategory[] = + const categories: CategoryExamples[] = categoryDefinition?.subcategories ?? []; if ( categories.length ) { return categories.reduce( - ( acc, subcategoryDefinition ): CategoryExamples => { + ( acc, subcategoryDefinition ) => { const subcategoryExamples = getExamplesByCategory( subcategoryDefinition, examples diff --git a/packages/edit-site/src/components/style-book/color-examples.tsx b/packages/edit-site/src/components/style-book/color-examples.tsx index 1acc365fd25fbf..2f08697c69668e 100644 --- a/packages/edit-site/src/components/style-book/color-examples.tsx +++ b/packages/edit-site/src/components/style-book/color-examples.tsx @@ -9,11 +9,10 @@ import clsx from 'clsx'; import { __experimentalGrid as Grid } from '@wordpress/components'; import { View } from '@wordpress/primitives'; import { - // @ts-ignore getColorClassName, - // @ts-ignore __experimentalGetGradientClass, - // @ts-ignore + // @wordpress/block-editor imports are not typed. + // @ts-expect-error } from '@wordpress/block-editor'; /** diff --git a/packages/edit-site/src/components/style-book/examples.tsx b/packages/edit-site/src/components/style-book/examples.tsx index acc69c389742da..dde10d153fc377 100644 --- a/packages/edit-site/src/components/style-book/examples.tsx +++ b/packages/edit-site/src/components/style-book/examples.tsx @@ -3,15 +3,12 @@ */ import { __, sprintf } from '@wordpress/i18n'; import { - // @ts-ignore getBlockType, - // @ts-ignore getBlockTypes, - // @ts-ignore getBlockFromExample, - // @ts-ignore createBlock, - // @ts-ignore + // @wordpress/blocks imports are not typed. + // @ts-expect-error } from '@wordpress/blocks'; /**