From 8216c5f3985d212b55ab79c57081ba9815114b37 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Tue, 4 Aug 2026 15:22:11 +0530 Subject: [PATCH 1/9] ESLint: Ban `@ts-ignore` in favour of `@ts-expect-error` `@ts-ignore` keeps silently passing once the error it was added for is gone, leaving dead suppressions behind. Enable `@typescript-eslint/ban-ts-comment` so `@ts-ignore` and `@ts-nocheck` are errors, and `@ts-expect-error` requires a description. The rule only walks the comment list, so it applies to JSDoc-typed `.js` files as well as `.ts`/`.tsx`. Existing violations are fixed in follow-up commits. --- tools/eslint/config.mjs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/eslint/config.mjs b/tools/eslint/config.mjs index bc852532d2d0b6..21f309b136331d 100644 --- a/tools/eslint/config.mjs +++ b/tools/eslint/config.mjs @@ -281,6 +281,20 @@ export default dedupePlugins( [ 'import/resolver': require.resolve( './import-resolver.cjs' ), }, rules: { + /* + * `@ts-ignore` keeps silently passing even after the error it was + * added for is gone. Require `@ts-expect-error` instead, along with + * a description explaining why the suppression is needed. + */ + '@typescript-eslint/ban-ts-comment': [ + 'error', + { + 'ts-expect-error': 'allow-with-description', + 'ts-ignore': true, + 'ts-nocheck': true, + 'ts-check': false, + }, + ], 'react/jsx-boolean-value': 'error', 'react/jsx-curly-brace-presence': [ 'error', From d122236efa261a71cbe2ba10c29b0fd3818416be Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Tue, 4 Aug 2026 15:31:58 +0530 Subject: [PATCH 2/9] Views: Drop stale `@ts-ignore` directives The `@wordpress/preferences` package is typed now, so these suppressions no longer suppress anything. Confirmed via `tsc --build`, which reports them as unused `@ts-expect-error` directives once converted. --- packages/views/src/load-view.ts | 1 - packages/views/src/test/use-view.tsx | 1 - packages/views/src/use-view.ts | 1 - 3 files changed, 3 deletions(-) diff --git a/packages/views/src/load-view.ts b/packages/views/src/load-view.ts index 66424b90828fca..573963c7854327 100644 --- a/packages/views/src/load-view.ts +++ b/packages/views/src/load-view.ts @@ -2,7 +2,6 @@ * WordPress dependencies */ import { select } from '@wordpress/data'; -// @ts-ignore - Preferences package is not typed import { store as preferencesStore } from '@wordpress/preferences'; /** diff --git a/packages/views/src/test/use-view.tsx b/packages/views/src/test/use-view.tsx index e11dc8b3eaee95..5e2228440a671f 100644 --- a/packages/views/src/test/use-view.tsx +++ b/packages/views/src/test/use-view.tsx @@ -7,7 +7,6 @@ import { act, renderHook } from '@testing-library/react'; * WordPress dependencies */ import { createRegistry, RegistryProvider } from '@wordpress/data'; -// @ts-ignore - Preferences package is not typed import { store as preferencesStore } from '@wordpress/preferences'; import type { View } from '@wordpress/dataviews'; diff --git a/packages/views/src/use-view.ts b/packages/views/src/use-view.ts index 8ad4367124fcd8..2c733ea1c09a9b 100644 --- a/packages/views/src/use-view.ts +++ b/packages/views/src/use-view.ts @@ -9,7 +9,6 @@ import { dequal } from 'dequal'; import { useCallback, useMemo } from '@wordpress/element'; import { useDispatch, useSelect } from '@wordpress/data'; import type { View } from '@wordpress/dataviews'; -// @ts-ignore - Preferences package is not typed import { store as preferencesStore } from '@wordpress/preferences'; /** From 5270d9483bf15fd7aac95d22d1235895beb1a376 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Tue, 4 Aug 2026 15:35:25 +0530 Subject: [PATCH 3/9] Blocks, Boot, Compose, Date, Sync: Replace `@ts-ignore` with `@ts-expect-error` Convert the live suppressions and describe what each one covers. Drop the ones `tsc` reports as unused, which no longer suppress anything. --- packages/blocks/src/api/matchers.ts | 2 +- packages/blocks/src/api/parser/get-block-attributes.ts | 2 +- packages/blocks/src/store/process-block-type.ts | 3 +-- .../boot/src/components/navigation/drilldown-item/index.tsx | 1 - .../boot/src/components/navigation/dropdown-item/index.tsx | 3 +-- packages/boot/src/components/navigation/index.tsx | 2 +- .../boot/src/components/navigation/navigation-item/index.tsx | 1 - packages/boot/src/components/navigation/use-sidebar-parent.ts | 2 +- packages/compose/src/higher-order/with-global-events/index.js | 1 - packages/compose/src/higher-order/with-instance-id/index.tsx | 2 +- packages/compose/src/higher-order/with-safe-timeout/index.tsx | 2 +- packages/date/src/index.ts | 1 - packages/sync/src/quill-delta/Delta.ts | 1 - 13 files changed, 8 insertions(+), 15 deletions(-) diff --git a/packages/blocks/src/api/matchers.ts b/packages/blocks/src/api/matchers.ts index 8b35d28f4ecb98..9c588dbc285845 100644 --- a/packages/blocks/src/api/matchers.ts +++ b/packages/blocks/src/api/matchers.ts @@ -1,7 +1,7 @@ /** * External dependencies */ -// @ts-ignore +// @ts-expect-error `hpq` does not ship type declarations. export { attr, prop, text, query } from 'hpq'; /** diff --git a/packages/blocks/src/api/parser/get-block-attributes.ts b/packages/blocks/src/api/parser/get-block-attributes.ts index 8cc4ddbebe4eb5..33c5c74650471b 100644 --- a/packages/blocks/src/api/parser/get-block-attributes.ts +++ b/packages/blocks/src/api/parser/get-block-attributes.ts @@ -1,7 +1,7 @@ /** * External dependencies */ -// @ts-ignore +// @ts-expect-error `hpq` does not ship type declarations. import { parse as hpqParse } from 'hpq'; import memoize from 'memize'; diff --git a/packages/blocks/src/store/process-block-type.ts b/packages/blocks/src/store/process-block-type.ts index caedcf825b32c6..23d5fa6e1bc82c 100644 --- a/packages/blocks/src/store/process-block-type.ts +++ b/packages/blocks/src/store/process-block-type.ts @@ -1,9 +1,8 @@ /** * External dependencies */ -// @ts-ignore -- No declaration file available. +// @ts-expect-error -- No usable declaration file available. import { isPlainObject } from 'is-plain-object'; -// @ts-ignore -- No declaration file available. import { isValidElementType } from 'react-is'; /** diff --git a/packages/boot/src/components/navigation/drilldown-item/index.tsx b/packages/boot/src/components/navigation/drilldown-item/index.tsx index 294a9c8ab2d96d..9561e6e44ea1f7 100644 --- a/packages/boot/src/components/navigation/drilldown-item/index.tsx +++ b/packages/boot/src/components/navigation/drilldown-item/index.tsx @@ -10,7 +10,6 @@ import type { ReactNode } from 'react'; import { FlexBlock, __experimentalItem as Item, - // @ts-ignore __experimentalHStack as HStack, Icon as WCIcon, } from '@wordpress/components'; diff --git a/packages/boot/src/components/navigation/dropdown-item/index.tsx b/packages/boot/src/components/navigation/dropdown-item/index.tsx index 581173358e0c5f..8105bac18f5c66 100644 --- a/packages/boot/src/components/navigation/dropdown-item/index.tsx +++ b/packages/boot/src/components/navigation/dropdown-item/index.tsx @@ -10,7 +10,6 @@ import type { ReactNode } from 'react'; import { FlexBlock, __experimentalItem as Item, - // @ts-ignore __experimentalHStack as HStack, Icon as WCIcon, __unstableMotion as motion, @@ -72,7 +71,7 @@ export default function DropdownItem( { }: DropdownItemProps ) { const menuItems: MenuItem[] = useSelect( ( select ) => - // @ts-ignore + // @ts-expect-error The boot store is untyped, so `select()` resolves to `never`. select( STORE_NAME ).getMenuItems(), [] ); diff --git a/packages/boot/src/components/navigation/index.tsx b/packages/boot/src/components/navigation/index.tsx index b903ca0ace3c93..d74b13cad88014 100644 --- a/packages/boot/src/components/navigation/index.tsx +++ b/packages/boot/src/components/navigation/index.tsx @@ -24,7 +24,7 @@ function Navigation() { useSidebarParent(); const menuItems = useSelect( ( select ) => - // @ts-ignore + // @ts-expect-error The boot store is untyped, so `select()` resolves to `never`. select( STORE_NAME ).getMenuItems() as MenuItem[], [] ); diff --git a/packages/boot/src/components/navigation/navigation-item/index.tsx b/packages/boot/src/components/navigation/navigation-item/index.tsx index f353f249068045..a0b0a2b53adae3 100644 --- a/packages/boot/src/components/navigation/navigation-item/index.tsx +++ b/packages/boot/src/components/navigation/navigation-item/index.tsx @@ -10,7 +10,6 @@ import type { ReactNode } from 'react'; import { FlexBlock, __experimentalItem as Item, - // @ts-ignore __experimentalHStack as HStack, } from '@wordpress/components'; diff --git a/packages/boot/src/components/navigation/use-sidebar-parent.ts b/packages/boot/src/components/navigation/use-sidebar-parent.ts index e8bbf4ce1cb361..1f2bbc53afc6b8 100644 --- a/packages/boot/src/components/navigation/use-sidebar-parent.ts +++ b/packages/boot/src/components/navigation/use-sidebar-parent.ts @@ -37,7 +37,7 @@ export function useSidebarParent() { const router = useRouter(); const menuItems = useSelect( ( select ) => - // @ts-ignore + // @ts-expect-error The boot store is untyped, so `select()` resolves to `never`. select( STORE_NAME ).getMenuItems(), [] ); diff --git a/packages/compose/src/higher-order/with-global-events/index.js b/packages/compose/src/higher-order/with-global-events/index.js index de8683d141c578..8568573e5b9aea 100644 --- a/packages/compose/src/higher-order/with-global-events/index.js +++ b/packages/compose/src/higher-order/with-global-events/index.js @@ -40,7 +40,6 @@ export default function withGlobalEvents( eventTypesToHandlers ) { alternative: 'useEffect', } ); - // @ts-ignore We don't need to fix the type-related issues because this is deprecated. return createHigherOrderComponent( ( WrappedComponent ) => { class Wrapper extends Component { constructor( /** @type {any} */ props ) { diff --git a/packages/compose/src/higher-order/with-instance-id/index.tsx b/packages/compose/src/higher-order/with-instance-id/index.tsx index 3b4131930bf1bf..a83a94faf17a77 100644 --- a/packages/compose/src/higher-order/with-instance-id/index.tsx +++ b/packages/compose/src/higher-order/with-instance-id/index.tsx @@ -19,7 +19,7 @@ const withInstanceId = createHigherOrderComponent( ) => { return ( props: WithoutInjectedProps< C, InstanceIdProps > ) => { const instanceId = useInstanceId( WrappedComponent ); - // @ts-ignore + // @ts-expect-error `LibraryManagedAttributes` cannot see the injected `instanceId` prop. return ; }; }, diff --git a/packages/compose/src/higher-order/with-safe-timeout/index.tsx b/packages/compose/src/higher-order/with-safe-timeout/index.tsx index 73e8faec6c1011..73fee65a18245d 100644 --- a/packages/compose/src/higher-order/with-safe-timeout/index.tsx +++ b/packages/compose/src/higher-order/with-safe-timeout/index.tsx @@ -66,7 +66,7 @@ const withSafeTimeout = createHigherOrderComponent( render() { return ( - // @ts-ignore + // @ts-expect-error `LibraryManagedAttributes` cannot see the injected timeout props. Date: Tue, 4 Aug 2026 15:41:35 +0530 Subject: [PATCH 4/9] Core Data, Editor, Fields: Replace `@ts-ignore` with `@ts-expect-error` Describe each live suppression with the reason `tsc` actually reports, and drop the directives that no longer suppress anything. Also corrects the Boot and Blocks descriptions from the previous commit. --- packages/blocks/src/store/process-block-type.ts | 2 +- .../boot/src/components/navigation/dropdown-item/index.tsx | 2 +- packages/boot/src/components/navigation/index.tsx | 2 +- .../boot/src/components/navigation/use-sidebar-parent.ts | 2 +- packages/core-data/src/awareness/block-lookup.ts | 2 +- packages/core-data/src/awareness/post-editor-awareness.ts | 4 ++-- packages/core-data/src/batch/default-processor.js | 1 - packages/core-data/src/hooks/use-entity-records.ts | 4 ++-- packages/core-data/src/utils/crdt-user-selections.ts | 2 +- .../editor/src/components/style-book/color-examples.tsx | 3 +-- .../src/components/sync-connection-error-modal/index.tsx | 1 - .../fields/content-preview/content-preview-view.tsx | 6 ++---- .../src/dataviews/fields/revisions/revisions-view.tsx | 4 +--- packages/editor/src/dataviews/store/private-actions.ts | 4 +--- packages/fields/src/actions/delete-post.tsx | 2 +- packages/fields/src/actions/duplicate-pattern.tsx | 2 +- packages/fields/src/actions/duplicate-post.tsx | 2 +- packages/fields/src/actions/duplicate-template-part.tsx | 1 - packages/fields/src/actions/rename-post.tsx | 2 +- packages/fields/src/actions/reset-post.tsx | 1 - packages/fields/src/fields/parent/parent-edit.tsx | 1 - packages/fields/src/fields/pattern-sync-status/index.tsx | 2 +- packages/fields/src/fields/pattern-title/view.tsx | 2 +- 23 files changed, 21 insertions(+), 33 deletions(-) diff --git a/packages/blocks/src/store/process-block-type.ts b/packages/blocks/src/store/process-block-type.ts index 23d5fa6e1bc82c..6a99d1852fa42c 100644 --- a/packages/blocks/src/store/process-block-type.ts +++ b/packages/blocks/src/store/process-block-type.ts @@ -1,7 +1,7 @@ /** * External dependencies */ -// @ts-expect-error -- No usable declaration file available. +// @ts-expect-error -- Its declaration file is not exposed through the `exports` map. import { isPlainObject } from 'is-plain-object'; import { isValidElementType } from 'react-is'; diff --git a/packages/boot/src/components/navigation/dropdown-item/index.tsx b/packages/boot/src/components/navigation/dropdown-item/index.tsx index 8105bac18f5c66..07c05755375806 100644 --- a/packages/boot/src/components/navigation/dropdown-item/index.tsx +++ b/packages/boot/src/components/navigation/dropdown-item/index.tsx @@ -71,7 +71,7 @@ export default function DropdownItem( { }: DropdownItemProps ) { const menuItems: MenuItem[] = useSelect( ( select ) => - // @ts-expect-error The boot store is untyped, so `select()` resolves to `never`. + // @ts-expect-error Store types are not available when selecting by store name. select( STORE_NAME ).getMenuItems(), [] ); diff --git a/packages/boot/src/components/navigation/index.tsx b/packages/boot/src/components/navigation/index.tsx index d74b13cad88014..3b38ae7bd95c6b 100644 --- a/packages/boot/src/components/navigation/index.tsx +++ b/packages/boot/src/components/navigation/index.tsx @@ -24,7 +24,7 @@ function Navigation() { useSidebarParent(); const menuItems = useSelect( ( select ) => - // @ts-expect-error The boot store is untyped, so `select()` resolves to `never`. + // @ts-expect-error Store types are not available when selecting by store name. select( STORE_NAME ).getMenuItems() as MenuItem[], [] ); diff --git a/packages/boot/src/components/navigation/use-sidebar-parent.ts b/packages/boot/src/components/navigation/use-sidebar-parent.ts index 1f2bbc53afc6b8..1f0c6099917f33 100644 --- a/packages/boot/src/components/navigation/use-sidebar-parent.ts +++ b/packages/boot/src/components/navigation/use-sidebar-parent.ts @@ -37,7 +37,7 @@ export function useSidebarParent() { const router = useRouter(); const menuItems = useSelect( ( select ) => - // @ts-expect-error The boot store is untyped, so `select()` resolves to `never`. + // @ts-expect-error Store types are not available when selecting by store name. select( STORE_NAME ).getMenuItems(), [] ); diff --git a/packages/core-data/src/awareness/block-lookup.ts b/packages/core-data/src/awareness/block-lookup.ts index 01c2fdc5d2fdf0..9362f402aecacc 100644 --- a/packages/core-data/src/awareness/block-lookup.ts +++ b/packages/core-data/src/awareness/block-lookup.ts @@ -3,7 +3,7 @@ */ import { useSelect } from '@wordpress/data'; import { Y } from '@wordpress/sync'; -// @ts-ignore No exported types for block editor store selectors. +// @ts-expect-error `@wordpress/block-editor` is not typed yet. import { store as blockEditorStore } from '@wordpress/block-editor'; /** diff --git a/packages/core-data/src/awareness/post-editor-awareness.ts b/packages/core-data/src/awareness/post-editor-awareness.ts index af111554eb819b..76921673da15fb 100644 --- a/packages/core-data/src/awareness/post-editor-awareness.ts +++ b/packages/core-data/src/awareness/post-editor-awareness.ts @@ -3,7 +3,7 @@ */ import { dispatch, select, subscribe } from '@wordpress/data'; import { Y } from '@wordpress/sync'; -// @ts-ignore No exported types for block editor store selectors. +// @ts-expect-error `@wordpress/block-editor` is not typed yet. import { store as blockEditorStore } from '@wordpress/block-editor'; /** @@ -200,7 +200,7 @@ export class PostEditorAwareness extends BaseAwarenessState< PostEditorState > { undoIgnore: true, }; - // @ts-ignore Types are not provided when using store name instead of store instance. + // @ts-expect-error Types are not provided when using the store name instead of the store instance. dispatch( coreStore ).editEntityRecord( this.kind, this.name, diff --git a/packages/core-data/src/batch/default-processor.js b/packages/core-data/src/batch/default-processor.js index a60e62446c8a14..001d254fc392f5 100644 --- a/packages/core-data/src/batch/default-processor.js +++ b/packages/core-data/src/batch/default-processor.js @@ -41,7 +41,6 @@ export default async function defaultProcessor( requests ) { const results = []; - // @ts-ignore We would have crashed or never gotten to this point if we hadn't received the maxItems count. for ( const batchRequests of chunk( requests, maxItems ) ) { const batchResponse = await apiFetch( { path: '/batch/v1', diff --git a/packages/core-data/src/hooks/use-entity-records.ts b/packages/core-data/src/hooks/use-entity-records.ts index 0e9eec3beaf5e5..e9f7b1b938f24b 100644 --- a/packages/core-data/src/hooks/use-entity-records.ts +++ b/packages/core-data/src/hooks/use-entity-records.ts @@ -208,7 +208,7 @@ export function useEntityRecordsWithPermissions< RecordType >( const ids = useMemo( () => data?.map( - // @ts-ignore + // @ts-expect-error `data` is `unknown[]`, so the callback signature does not line up. ( record: RecordType ) => record[ entityConfig?.key ?? 'id' ] ) ?? [], [ data, entityConfig?.key ] @@ -227,7 +227,7 @@ export function useEntityRecordsWithPermissions< RecordType >( const dataWithPermissions = useMemo( () => data?.map( ( record, index ) => ( { - // @ts-ignore + // @ts-expect-error `record` is `unknown`, which cannot be spread. ...record, permissions: permissions[ index ], } ) ) ?? [], diff --git a/packages/core-data/src/utils/crdt-user-selections.ts b/packages/core-data/src/utils/crdt-user-selections.ts index a0c55a78021533..19c88b5ecdb4c1 100644 --- a/packages/core-data/src/utils/crdt-user-selections.ts +++ b/packages/core-data/src/utils/crdt-user-selections.ts @@ -3,7 +3,7 @@ */ import { select } from '@wordpress/data'; import { Y } from '@wordpress/sync'; -// @ts-ignore No exported types for block editor store selectors. +// @ts-expect-error `@wordpress/block-editor` is not typed yet. import { store as blockEditorStore } from '@wordpress/block-editor'; /** diff --git a/packages/editor/src/components/style-book/color-examples.tsx b/packages/editor/src/components/style-book/color-examples.tsx index 66318b750492d2..6f33ab90689e64 100644 --- a/packages/editor/src/components/style-book/color-examples.tsx +++ b/packages/editor/src/components/style-book/color-examples.tsx @@ -10,8 +10,7 @@ import { __experimentalGrid as Grid } from '@wordpress/components'; import { getColorClassName, __experimentalGetGradientClass, - // @wordpress/block-editor imports are not typed. - // @ts-expect-error + // @ts-expect-error `@wordpress/block-editor` is not typed yet. } from '@wordpress/block-editor'; /** diff --git a/packages/editor/src/components/sync-connection-error-modal/index.tsx b/packages/editor/src/components/sync-connection-error-modal/index.tsx index c9d7c0b28ea7de..99f3ed511b1976 100644 --- a/packages/editor/src/components/sync-connection-error-modal/index.tsx +++ b/packages/editor/src/components/sync-connection-error-modal/index.tsx @@ -3,7 +3,6 @@ */ import { useSelect, select } from '@wordpress/data'; import { useCopyToClipboard } from '@wordpress/compose'; -// @ts-ignore No exported types. import { serialize } from '@wordpress/blocks'; import { store as coreDataStore, diff --git a/packages/editor/src/dataviews/fields/content-preview/content-preview-view.tsx b/packages/editor/src/dataviews/fields/content-preview/content-preview-view.tsx index 2869b968138cd2..0d113519650ae7 100644 --- a/packages/editor/src/dataviews/fields/content-preview/content-preview-view.tsx +++ b/packages/editor/src/dataviews/fields/content-preview/content-preview-view.tsx @@ -3,9 +3,8 @@ */ import { __ } from '@wordpress/i18n'; import { - // @ts-ignore BlockPreview, - // @ts-ignore + // @ts-expect-error `@wordpress/block-editor` is not typed yet. } from '@wordpress/block-editor'; import type { BasePost } from '@wordpress/fields'; import { useSelect } from '@wordpress/data'; @@ -17,7 +16,6 @@ import { useEntityBlockEditor, store as coreStore } from '@wordpress/core-data'; import { EditorProvider } from '../../../components/provider'; import { useStyle } from '../../../components/global-styles'; import { unlock } from '../../../lock-unlock'; -// @ts-ignore import { store as editorStore } from '../../../store'; function PostPreviewContainer( { @@ -71,7 +69,7 @@ export default function PostPreviewView( { item }: { item: BasePost } ) { name: 'wp_template', } ); const _settings = select( editorStore ).getEditorSettings(); - // @ts-ignore + // @ts-expect-error Editor settings are typed as a bare `Object`. const supportsTemplateMode = _settings.supportsTemplateMode; const isViewable = getPostType( item.type )?.viewable ?? false; diff --git a/packages/editor/src/dataviews/fields/revisions/revisions-view.tsx b/packages/editor/src/dataviews/fields/revisions/revisions-view.tsx index 9fa3163951cb94..c974ce98d123b2 100644 --- a/packages/editor/src/dataviews/fields/revisions/revisions-view.tsx +++ b/packages/editor/src/dataviews/fields/revisions/revisions-view.tsx @@ -9,7 +9,6 @@ import { addQueryArgs } from '@wordpress/url'; /** * Internal dependencies */ -// @ts-ignore import { store as editorStore } from '../../../store'; import { unlock } from '../../../lock-unlock'; @@ -20,13 +19,12 @@ export default function RevisionsView() { getCurrentPostLastRevisionId, getCurrentPostRevisionsCount, getEditorSettings, - // @ts-ignore } = select( editorStore ); return { lastRevisionId: getCurrentPostLastRevisionId(), revisionsCount: getCurrentPostRevisionsCount(), disableVisualRevisions: - // @ts-ignore + // @ts-expect-error Editor settings are typed as a bare `Object`. !! getEditorSettings().disableVisualRevisions, }; }, [] ); diff --git a/packages/editor/src/dataviews/store/private-actions.ts b/packages/editor/src/dataviews/store/private-actions.ts index ffca8f1da7e979..988cc5896f789f 100644 --- a/packages/editor/src/dataviews/store/private-actions.ts +++ b/packages/editor/src/dataviews/store/private-actions.ts @@ -217,7 +217,7 @@ export const registerPostTypeSchema = canCreate && duplicatePost; - // @ts-ignore + // @ts-expect-error `globalThis` has no index signature for this build-time global. if ( ! globalThis.IS_GUTENBERG_PLUGIN ) { // Outside Gutenberg, disable duplication except for wp_template. if ( 'wp_template' !== postTypeConfig.slug ) { @@ -226,7 +226,6 @@ export const registerPostTypeSchema = } // When template activation experiment is disabled, templates cannot be duplicated. - // @ts-ignore if ( postTypeConfig.slug === 'wp_template' && ! window?.__experimentalTemplateActivate @@ -239,7 +238,6 @@ export const registerPostTypeSchema = !! postTypeConfig.supports?.revisions ? viewPostRevisions : undefined, - // @ts-ignore canDuplicate, postTypeConfig.slug === 'wp_template_part' && canCreate && diff --git a/packages/fields/src/actions/delete-post.tsx b/packages/fields/src/actions/delete-post.tsx index 9fafb4db4a69d8..6dd759b491fdb1 100644 --- a/packages/fields/src/actions/delete-post.tsx +++ b/packages/fields/src/actions/delete-post.tsx @@ -10,7 +10,7 @@ import { __experimentalHStack as HStack, __experimentalVStack as VStack, } from '@wordpress/components'; -// @ts-ignore +// @ts-expect-error `@wordpress/patterns` is not typed yet. import { privateApis as patternsPrivateApis } from '@wordpress/patterns'; import type { Action } from '@wordpress/dataviews'; import { decodeEntities } from '@wordpress/html-entities'; diff --git a/packages/fields/src/actions/duplicate-pattern.tsx b/packages/fields/src/actions/duplicate-pattern.tsx index 2df348a1cef3c0..264083575db62f 100644 --- a/packages/fields/src/actions/duplicate-pattern.tsx +++ b/packages/fields/src/actions/duplicate-pattern.tsx @@ -2,7 +2,7 @@ * WordPress dependencies */ import { _x } from '@wordpress/i18n'; -// @ts-ignore +// @ts-expect-error `@wordpress/patterns` is not typed yet. import { privateApis as patternsPrivateApis } from '@wordpress/patterns'; import type { Action } from '@wordpress/dataviews'; diff --git a/packages/fields/src/actions/duplicate-post.tsx b/packages/fields/src/actions/duplicate-post.tsx index af778cb8ee0ec4..e1d9550548cd59 100644 --- a/packages/fields/src/actions/duplicate-post.tsx +++ b/packages/fields/src/actions/duplicate-post.tsx @@ -98,7 +98,7 @@ const duplicatePost: Action< BasePost > = { ); assignableProperties.forEach( ( property ) => { if ( item.hasOwnProperty( property ) ) { - // @ts-ignore + // @ts-expect-error `property` is a dynamic string key on both objects. newItemObject[ property ] = item[ property ]; } } ); diff --git a/packages/fields/src/actions/duplicate-template-part.tsx b/packages/fields/src/actions/duplicate-template-part.tsx index 0524f5308da78c..b2d6bc43b1f4ef 100644 --- a/packages/fields/src/actions/duplicate-template-part.tsx +++ b/packages/fields/src/actions/duplicate-template-part.tsx @@ -5,7 +5,6 @@ import { useDispatch } from '@wordpress/data'; import { _x, sprintf } from '@wordpress/i18n'; import { store as noticesStore } from '@wordpress/notices'; import { useMemo } from '@wordpress/element'; -// @ts-ignore import { parse } from '@wordpress/blocks'; import type { Action } from '@wordpress/dataviews'; diff --git a/packages/fields/src/actions/rename-post.tsx b/packages/fields/src/actions/rename-post.tsx index 1a9decc993c550..c9024706e67fe6 100644 --- a/packages/fields/src/actions/rename-post.tsx +++ b/packages/fields/src/actions/rename-post.tsx @@ -5,7 +5,7 @@ import { useDispatch } from '@wordpress/data'; import { store as coreStore } from '@wordpress/core-data'; import { __ } from '@wordpress/i18n'; import { useState } from '@wordpress/element'; -// @ts-ignore +// @ts-expect-error `@wordpress/patterns` is not typed yet. import { privateApis as patternsPrivateApis } from '@wordpress/patterns'; import { Button, diff --git a/packages/fields/src/actions/reset-post.tsx b/packages/fields/src/actions/reset-post.tsx index 16c137ccb68d1b..8d2208fea9333e 100644 --- a/packages/fields/src/actions/reset-post.tsx +++ b/packages/fields/src/actions/reset-post.tsx @@ -7,7 +7,6 @@ import { store as coreStore } from '@wordpress/core-data'; import { __, sprintf } from '@wordpress/i18n'; import { store as noticesStore } from '@wordpress/notices'; import { useState } from '@wordpress/element'; -// @ts-ignore import { parse, __unstableSerializeAndClean } from '@wordpress/blocks'; import { Button, diff --git a/packages/fields/src/fields/parent/parent-edit.tsx b/packages/fields/src/fields/parent/parent-edit.tsx index 74fefd87ecec73..4d3c9051223ce3 100644 --- a/packages/fields/src/fields/parent/parent-edit.tsx +++ b/packages/fields/src/fields/parent/parent-edit.tsx @@ -14,7 +14,6 @@ import { useMemo, useState, } from '@wordpress/element'; -// @ts-ignore import { store as coreStore } from '@wordpress/core-data'; import type { DataFormControlProps } from '@wordpress/dataviews'; import { debounce } from '@wordpress/compose'; diff --git a/packages/fields/src/fields/pattern-sync-status/index.tsx b/packages/fields/src/fields/pattern-sync-status/index.tsx index 36d26789927a89..dd1a742ed382f5 100644 --- a/packages/fields/src/fields/pattern-sync-status/index.tsx +++ b/packages/fields/src/fields/pattern-sync-status/index.tsx @@ -3,7 +3,7 @@ */ import type { Field } from '@wordpress/dataviews'; import { __, _x } from '@wordpress/i18n'; -// @ts-ignore +// @ts-expect-error `@wordpress/patterns` is not typed yet. import { privateApis as patternPrivateApis } from '@wordpress/patterns'; /** diff --git a/packages/fields/src/fields/pattern-title/view.tsx b/packages/fields/src/fields/pattern-title/view.tsx index fe71e7bef67fe1..c52fd9fc0449ee 100644 --- a/packages/fields/src/fields/pattern-title/view.tsx +++ b/packages/fields/src/fields/pattern-title/view.tsx @@ -3,7 +3,7 @@ */ import { __ } from '@wordpress/i18n'; import { Icon, lockSmall } from '@wordpress/icons'; -// @ts-ignore +// @ts-expect-error `@wordpress/patterns` is not typed yet. import { privateApis as patternPrivateApis } from '@wordpress/patterns'; import { Tooltip, VisuallyHidden } from '@wordpress/ui'; From 260ea64b8e408d54c8febd79d8b644e157452326 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Tue, 4 Aug 2026 15:51:24 +0530 Subject: [PATCH 5/9] Global Styles, Interactivity Router, Media Editor, Tools: Replace `@ts-ignore` Describe each live suppression with the reason `tsc` reports, and drop the ones that suppress nothing. `tools/` and `routes/` belong to no TypeScript project, so their directives were checked against a temporary project built on `tsconfig.base.json`. --- packages/global-styles-engine/src/core/merge.ts | 2 +- packages/global-styles-engine/src/core/render.tsx | 2 +- .../global-styles-engine/src/utils/background.ts | 2 +- packages/global-styles-engine/src/utils/common.ts | 4 ++-- packages/global-styles-engine/src/utils/object.ts | 8 ++++---- .../src/font-library/font-collection.tsx | 7 +++++-- .../font-library/utils/make-families-from-faces.ts | 2 +- .../src/font-library/utils/set-immutably.ts | 6 +++--- packages/interactivity-router/src/index.ts | 8 ++++---- .../src/components/media-editor/index.tsx | 3 +-- .../lib/tasks/add-milestone/index.js | 2 +- routes/connectors-home/ai-plugin-callout.tsx | 2 +- routes/guidelines/data.ts | 1 - tools/docs/update-api-docs.js | 1 - tools/release/commands/changelog.js | 1 - tools/release/commands/performance.js | 14 ++++++-------- tools/release/lib/utils.js | 1 - 17 files changed, 31 insertions(+), 35 deletions(-) diff --git a/packages/global-styles-engine/src/core/merge.ts b/packages/global-styles-engine/src/core/merge.ts index 83a7b6492d2f80..293ef0f0905301 100644 --- a/packages/global-styles-engine/src/core/merge.ts +++ b/packages/global-styles-engine/src/core/merge.ts @@ -2,7 +2,7 @@ * External dependencies */ import deepmerge from 'deepmerge'; -// @ts-ignore - is-plain-object doesn't have proper types +// @ts-expect-error Its declaration file is not exposed through the `exports` map. import { isPlainObject } from 'is-plain-object'; /** diff --git a/packages/global-styles-engine/src/core/render.tsx b/packages/global-styles-engine/src/core/render.tsx index 788ebd25176912..e3f693418b02f1 100644 --- a/packages/global-styles-engine/src/core/render.tsx +++ b/packages/global-styles-engine/src/core/render.tsx @@ -1922,7 +1922,7 @@ export const getBlockSelectors = ( !! blockType?.supports?.layout || !! blockType?.supports?.__experimentalLayout; const fallbackGapValue = - // @ts-expect-error + // @ts-expect-error `blockGap` support is typed as `boolean | AxialDirection[]`. blockType?.supports?.spacing?.blockGap?.__experimentalDefault; const blockStyleVariations = getBlockStyles( name ); diff --git a/packages/global-styles-engine/src/utils/background.ts b/packages/global-styles-engine/src/utils/background.ts index d706ab9df7411d..41efe615b0b05d 100644 --- a/packages/global-styles-engine/src/utils/background.ts +++ b/packages/global-styles-engine/src/utils/background.ts @@ -11,7 +11,7 @@ export const BACKGROUND_BLOCK_DEFAULT_VALUES = { export function setBackgroundStyleDefaults( backgroundStyle: BackgroundStyle ) { if ( ! backgroundStyle || - // @ts-expect-error + // @ts-expect-error `backgroundImage` is a union whose other members have no `url`. ! backgroundStyle?.backgroundImage?.url ) { return; diff --git a/packages/global-styles-engine/src/utils/common.ts b/packages/global-styles-engine/src/utils/common.ts index de88c979ece486..5bdaab18ffbfe9 100644 --- a/packages/global-styles-engine/src/utils/common.ts +++ b/packages/global-styles-engine/src/utils/common.ts @@ -256,7 +256,7 @@ export function scopeFeatureSelectors( Object.entries( selector ).forEach( ( [ subfeature, subfeatureSelector ] ) => { - // @ts-expect-error + // @ts-expect-error A string key cannot index `string | Record`. featureSelectors[ feature ][ subfeature ] = scopeSelector( scope, subfeatureSelector as string @@ -509,7 +509,7 @@ function findInPresetsBy( // Preset origins ordered by priority. const origins = [ 'custom', 'theme', 'default' ]; for ( const origin of origins ) { - // @ts-expect-error + // @ts-expect-error `presetByOrigin` is typed as `Object`, which has no index signature. const presets = presetByOrigin[ origin ]; if ( presets ) { const presetObject = presets.find( diff --git a/packages/global-styles-engine/src/utils/object.ts b/packages/global-styles-engine/src/utils/object.ts index cdbc1890a2f1d4..479d4f3e426507 100644 --- a/packages/global-styles-engine/src/utils/object.ts +++ b/packages/global-styles-engine/src/utils/object.ts @@ -24,12 +24,12 @@ export function setImmutably( // Traverse object from root to leaf, shallowly cloning at each level let prev = object; for ( const key of path ) { - // @ts-expect-error + // @ts-expect-error `prev` is typed as `Object`, which has no index signature. const lvl = prev[ key ]; - // @ts-expect-error + // @ts-expect-error `prev` is typed as `Object`, which has no index signature. prev = prev[ key ] = Array.isArray( lvl ) ? [ ...lvl ] : { ...lvl }; } - // @ts-expect-error + // @ts-expect-error `leaf` is possibly `undefined`, which cannot be an index type. prev[ leaf ] = value; return object; @@ -57,7 +57,7 @@ export const getValueFromObjectPath = ( const arrayPath = Array.isArray( path ) ? path : path.split( '.' ); let value = object; arrayPath.forEach( ( fieldName ) => { - // @ts-expect-error + // @ts-expect-error `value` is typed as `Object`, which has no index signature. value = value?.[ fieldName ]; } ); return value ?? defaultValue; diff --git a/packages/global-styles-ui/src/font-library/font-collection.tsx b/packages/global-styles-ui/src/font-library/font-collection.tsx index e3f9667da173e4..f30af456bc1512 100644 --- a/packages/global-styles-ui/src/font-library/font-collection.tsx +++ b/packages/global-styles-ui/src/font-library/font-collection.tsx @@ -158,8 +158,11 @@ function FontCollection( { slug }: { slug: string } ) { setPage( 1 ); }; - // @ts-expect-error - const debouncedUpdateSearchInput = debounce( handleUpdateSearchInput, 300 ); + const debouncedUpdateSearchInput = debounce( + // @ts-expect-error `debounce` expects a `(...args: unknown[]) => unknown` callback. + handleUpdateSearchInput, + 300 + ); const handleToggleVariant = ( font: FontFamily, face?: FontFace ) => { const newFontsToInstall = toggleFont( font, face, fontsToInstall ); diff --git a/packages/global-styles-ui/src/font-library/utils/make-families-from-faces.ts b/packages/global-styles-ui/src/font-library/utils/make-families-from-faces.ts index 5fd587c81692e7..dd0cd9adf63037 100644 --- a/packages/global-styles-ui/src/font-library/utils/make-families-from-faces.ts +++ b/packages/global-styles-ui/src/font-library/utils/make-families-from-faces.ts @@ -24,7 +24,7 @@ export default function makeFamiliesFromFaces( fontFace: [], }; } - // @ts-expect-error + // @ts-expect-error `acc[ item.fontFamily ]` is possibly `undefined`. acc[ item.fontFamily ].fontFace.push( item ); return acc; }, diff --git a/packages/global-styles-ui/src/font-library/utils/set-immutably.ts b/packages/global-styles-ui/src/font-library/utils/set-immutably.ts index 9d449764b05481..41d612d9a78876 100644 --- a/packages/global-styles-ui/src/font-library/utils/set-immutably.ts +++ b/packages/global-styles-ui/src/font-library/utils/set-immutably.ts @@ -25,12 +25,12 @@ export function setImmutably( // Traverse object from root to leaf, shallowly cloning at each level let prev = object; for ( const key of path ) { - // @ts-expect-error + // @ts-expect-error `prev` is typed as `Object`, which has no index signature. const lvl = prev[ key ]; - // @ts-expect-error + // @ts-expect-error `prev` is typed as `Object`, which has no index signature. prev = prev[ key ] = Array.isArray( lvl ) ? [ ...lvl ] : { ...lvl }; } - // @ts-expect-error + // @ts-expect-error `leaf` is possibly `undefined`, which cannot be an index type. prev[ leaf ] = value; return object; diff --git a/packages/interactivity-router/src/index.ts b/packages/interactivity-router/src/index.ts index 697da7db2bf04c..c44e2c91b43780 100644 --- a/packages/interactivity-router/src/index.ts +++ b/packages/interactivity-router/src/index.ts @@ -600,14 +600,14 @@ function a11ySpeak( messageKey: keyof typeof navigationTexts ) { // Fallback to localized strings from Interactivity API state. // @todo This block is for Core < 6.7.0. Remove when support is dropped. - // @ts-expect-error + // @ts-expect-error `texts` is not part of the typed navigation state. if ( state.navigation.texts?.loading ) { - // @ts-expect-error + // @ts-expect-error `texts` is not part of the typed navigation state. navigationTexts.loading = state.navigation.texts.loading; } - // @ts-expect-error + // @ts-expect-error `texts` is not part of the typed navigation state. if ( state.navigation.texts?.loaded ) { - // @ts-expect-error + // @ts-expect-error `texts` is not part of the typed navigation state. navigationTexts.loaded = state.navigation.texts.loaded; } } diff --git a/packages/media-editor/src/components/media-editor/index.tsx b/packages/media-editor/src/components/media-editor/index.tsx index 945a3b4005439f..dd877bff302991 100644 --- a/packages/media-editor/src/components/media-editor/index.tsx +++ b/packages/media-editor/src/components/media-editor/index.tsx @@ -32,8 +32,7 @@ import { ComplementaryArea, InterfaceSkeleton, PinnedItems, - // No type declarations available for @wordpress/interface. - // @ts-expect-error + // @ts-expect-error `@wordpress/interface` is not typed yet. } from '@wordpress/interface'; import type { KeyboardEvent as ReactKeyboardEvent, ReactNode } from 'react'; diff --git a/packages/project-management-automation/lib/tasks/add-milestone/index.js b/packages/project-management-automation/lib/tasks/add-milestone/index.js index 302c32ac79d4b8..6404a08fb31e17 100644 --- a/packages/project-management-automation/lib/tasks/add-milestone/index.js +++ b/packages/project-management-automation/lib/tasks/add-milestone/index.js @@ -111,7 +111,7 @@ async function addMilestone( payload, octokit ) { const { // The types for the `getContent` response are incorrect. // see https://github.com/octokit/rest.js/issues/32 - // @ts-ignore + // @ts-expect-error The `getContent` response is a union that may be a directory listing. data: { content, encoding }, } = await octokit.rest.repos.getContent( { owner, diff --git a/routes/connectors-home/ai-plugin-callout.tsx b/routes/connectors-home/ai-plugin-callout.tsx index aa63a8e02e6a37..725b52f34ed1dd 100644 --- a/routes/connectors-home/ai-plugin-callout.tsx +++ b/routes/connectors-home/ai-plugin-callout.tsx @@ -255,7 +255,7 @@ export function AiPluginCallout() {

{ createInterpolateElement( getMessage(), { strong: , - // @ts-ignore children are injected by createInterpolateElement at runtime. + // @ts-expect-error `children` is injected by `createInterpolateElement` at runtime. a: , } ) }

diff --git a/routes/guidelines/data.ts b/routes/guidelines/data.ts index 0222d4daeaf832..c17a241220bbfe 100644 --- a/routes/guidelines/data.ts +++ b/routes/guidelines/data.ts @@ -68,7 +68,6 @@ export function blockSlug( blockName: string ): string { export function useContentBlocks(): ContentBlock[] { return useSelect( ( s ) => - // @ts-ignore - getBlockTypes is untyped in this context. s( blocksStore ) .getBlockTypes() .filter( ( block: ContentBlock ) => diff --git a/tools/docs/update-api-docs.js b/tools/docs/update-api-docs.js index 4438915790e142..cdbd00e631c415 100755 --- a/tools/docs/update-api-docs.js +++ b/tools/docs/update-api-docs.js @@ -201,7 +201,6 @@ function findDefaultSourcePath( dir ) { if ( ! defaultPathMatches.length ) { throw new Error( `Cannot find default source file in ${ dir }` ); } - // @ts-ignore return defaultPathMatches[ 0 ]; } diff --git a/tools/release/commands/changelog.js b/tools/release/commands/changelog.js index 557da8aa76fa0d..358bd43a9db664 100644 --- a/tools/release/commands/changelog.js +++ b/tools/release/commands/changelog.js @@ -15,7 +15,6 @@ const { } = require( '../lib/milestone' ); const { log, warn, formats } = require( '../lib/logger' ); const config = require( '../config' ); -// @ts-ignore const manifest = require( '../../../package.json' ); const UNKNOWN_FEATURE_FALLBACK_NAME = 'Uncategorized'; diff --git a/tools/release/commands/performance.js b/tools/release/commands/performance.js index 0a65e675498a01..5cd3dc9980f1b2 100644 --- a/tools/release/commands/performance.js +++ b/tools/release/commands/performance.js @@ -301,7 +301,7 @@ async function runPerformanceTests( branches, options ) { logAtIndent( 2, 'Creating directory:', formats.success( sourceDir ) ); fs.mkdirSync( sourceDir ); - // @ts-ignore + // @ts-expect-error The `simple-git` module namespace has no call signatures. const sourceGit = SimpleGit( sourceDir ); logAtIndent( 2, @@ -328,7 +328,6 @@ async function runPerformanceTests( branches, options ) { 'Fetching test runner branch:', formats.success( options.testsBranch ) ); - // @ts-ignore await sourceGit.raw( 'fetch', '--depth=1', @@ -355,7 +354,7 @@ async function runPerformanceTests( branches, options ) { 'Checking out branch:', formats.success( testRunnerBranch ) ); - // @ts-ignore + // @ts-expect-error The `simple-git` module namespace has no call signatures. await SimpleGit( testRunnerDir ).raw( 'checkout', testRunnerBranch ); logAtIndent( 2, 'Installing dependencies and building' ); @@ -390,7 +389,7 @@ async function runPerformanceTests( branches, options ) { logAtIndent( 3, 'Creating directory:', formats.success( envDir ) ); fs.mkdirSync( envDir ); - // @ts-ignore + // @ts-expect-error `branchDirs` is inferred as `{}`, which has no string index signature. branchDirs[ branch ] = envDir; const buildDir = path.join( envDir, 'plugin' ); @@ -398,7 +397,7 @@ async function runPerformanceTests( branches, options ) { await runShellScript( `cp -R ${ sourceDir } ${ buildDir }` ); logAtIndent( 3, 'Checking out:', formats.success( branch ) ); - // @ts-ignore + // @ts-expect-error The `simple-git` module namespace has no call signatures. await SimpleGit( buildDir ).raw( 'checkout', branch ); logAtIndent( 3, 'Installing dependencies and building' ); @@ -490,7 +489,7 @@ async function runPerformanceTests( branches, options ) { ); const sanitizedBranchName = sanitizeBranchName( branch ); - // @ts-ignore + // @ts-expect-error `branchDirs` is inferred as `{}`, which has no string index signature. const envDir = branchDirs[ branch ]; logAtIndent( 2, 'Starting environment' ); @@ -525,9 +524,8 @@ async function runPerformanceTests( branches, options ) { // // npm run --workspace @wordpress/build-scripts resolve-trace-source-maps -- --build-dir const headBranch = branches[ 0 ]; - // @ts-ignore const headBuildScriptsDir = path.join( - // @ts-ignore + // @ts-expect-error `branchDirs` is inferred as `{}`, which has no string index signature. branchDirs[ headBranch ], 'plugin', 'build', diff --git a/tools/release/lib/utils.js b/tools/release/lib/utils.js index 9275af42955f2f..8b4338feb66c75 100644 --- a/tools/release/lib/utils.js +++ b/tools/release/lib/utils.js @@ -6,7 +6,6 @@ const childProcess = require( 'child_process' ); const { randomUUID } = require( 'crypto' ); const path = require( 'path' ); const os = require( 'os' ); -// @ts-ignore const { confirm } = require( '@inquirer/prompts' ); /** From e2db290d2841f38fa07857d95d463e1ad8a14e46 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Tue, 4 Aug 2026 16:05:49 +0530 Subject: [PATCH 6/9] Components, DataViews, Interactivity, Upload Media: Replace `@ts-ignore` Describe each remaining suppression and drop the ones that suppress nothing. Test directories excluded from the build were checked against a temporary project so the descriptions match a real diagnostic. --- .../src/middlewares/test/preloading.ts | 8 ++--- .../src/border-box-control/test/utils.ts | 20 +++++------ packages/components/src/button/test/index.tsx | 6 ++-- .../src/color-picker/input-with-slider.tsx | 2 +- .../components/src/context/context-connect.ts | 8 ++--- .../src/context/use-context-system.js | 8 ++--- .../src/custom-gradient-picker/index.tsx | 2 +- packages/components/src/disabled/index.tsx | 2 +- packages/components/src/draggable/index.tsx | 2 +- packages/components/src/icon/index.tsx | 2 +- .../components/src/input-control/utils.ts | 2 +- .../components/src/placeholder/test/index.tsx | 6 ++-- .../components/src/query-controls/index.tsx | 2 +- packages/components/src/utils/rtl.js | 4 +-- .../dataform-layouts/test/normalize-form.ts | 3 +- .../components/dataviews-filters/filter.tsx | 2 +- .../src/components/dataviews-footer/index.tsx | 2 +- .../dataviews-layouts/activity/index.tsx | 4 +-- .../dataviews-layouts/grid/composite-grid.tsx | 4 +-- .../dataviews-layouts/table/index.tsx | 2 +- .../properties-section.tsx | 4 +-- .../src/dataform/stories/layout-regular.tsx | 2 +- .../src/dataviews/test/dataviews.tsx | 4 +-- .../src/field-types/test/normalize-fields.ts | 4 +-- .../src/hooks/test/use-form-validity.ts | 2 +- .../src/editor/select-blocks.ts | 4 +-- .../src/metrics/index.ts | 2 +- .../src/page-utils/press-keys.ts | 2 +- packages/interactivity/src/test/types.ts | 32 ++++++++--------- packages/interactivity/src/test/vdom.ts | 2 +- packages/upload-media/src/store/index.ts | 2 -- .../upload-media/src/store/test/actions.ts | 3 +- .../upload-media/src/test/canvas-utils.ts | 4 +-- .../src/test/feature-detection.ts | 36 +++++++++---------- 34 files changed, 95 insertions(+), 99 deletions(-) diff --git a/packages/api-fetch/src/middlewares/test/preloading.ts b/packages/api-fetch/src/middlewares/test/preloading.ts index 96352f60250db4..c00e957383f5e8 100644 --- a/packages/api-fetch/src/middlewares/test/preloading.ts +++ b/packages/api-fetch/src/middlewares/test/preloading.ts @@ -101,12 +101,12 @@ describe( 'Preloading Middleware', () => { const noResponseMock = 'undefined' === typeof window.Response; if ( noResponseMock ) { - // @ts-expect-error + // @ts-expect-error The stub does not implement the full `Response` static side. window.Response = class { constructor( body, options ) { - // @ts-expect-error + // @ts-expect-error `body` is not a declared property on the stub. this.body = JSON.parse( body ); - // @ts-expect-error + // @ts-expect-error `headers` is not a declared property on the stub. this.headers = options.headers; } }; @@ -141,7 +141,7 @@ describe( 'Preloading Middleware', () => { async () => {} ); if ( noResponseMock ) { - // @ts-expect-error + // @ts-expect-error The operand of `delete` must be optional. delete window.Response; } return response.then( ( value ) => { diff --git a/packages/components/src/border-box-control/test/utils.ts b/packages/components/src/border-box-control/test/utils.ts index 03fd7be1420f48..9a03a779015d87 100644 --- a/packages/components/src/border-box-control/test/utils.ts +++ b/packages/components/src/border-box-control/test/utils.ts @@ -48,14 +48,14 @@ describe( 'BorderBoxControl Utils', () => { it( 'should determine a undefined, null, and {} to be empty', () => { expect( isEmptyBorder( undefined ) ).toBe( true ); // Checking for extra resilience, even if not a valid type. - // @ts-expect-error + // @ts-expect-error Deliberately invalid input, to check runtime resilience. expect( isEmptyBorder( null ) ).toBe( true ); expect( isEmptyBorder( {} ) ).toBe( true ); } ); it( 'should determine object missing all border props to be empty', () => { // Checking for extra resilience, even if not a valid type. - // @ts-expect-error + // @ts-expect-error Deliberately invalid input, to check runtime resilience. expect( isEmptyBorder( nonBorder ) ).toBe( true ); } ); @@ -115,14 +115,14 @@ describe( 'BorderBoxControl Utils', () => { it( 'should determine a undefined, null, and {} to be incomplete', () => { expect( isCompleteBorder( undefined ) ).toBe( false ); // Checking for extra resilience, even if not a valid type. - // @ts-expect-error + // @ts-expect-error Deliberately invalid input, to check runtime resilience. expect( isCompleteBorder( null ) ).toBe( false ); expect( isCompleteBorder( {} ) ).toBe( false ); } ); it( 'should determine objects missing border props to be incomplete', () => { // Checking for extra resilience, even if not a valid type. - // @ts-expect-error + // @ts-expect-error Deliberately invalid input, to check runtime resilience. expect( isCompleteBorder( nonBorder ) ).toBe( false ); expect( isCompleteBorder( partialBorder ) ).toBe( false ); expect( isCompleteBorder( partialWithExtraProp ) ).toBe( false ); @@ -158,7 +158,7 @@ describe( 'BorderBoxControl Utils', () => { expect( hasMixedBorders( undefined ) ).toBe( false ); expect( hasMixedBorders( {} ) ).toBe( false ); // Checking for extra resilience, even if not a valid type. - // @ts-expect-error + // @ts-expect-error Deliberately invalid input, to check runtime resilience. expect( hasMixedBorders( nonBorder ) ).toBe( false ); } ); @@ -179,14 +179,14 @@ describe( 'BorderBoxControl Utils', () => { it( 'should return undefined when no border provided', () => { expect( getSplitBorders( undefined ) ).toEqual( undefined ); // Checking for extra resilience, even if not a valid type. - // @ts-expect-error + // @ts-expect-error Deliberately invalid input, to check runtime resilience. expect( getSplitBorders( null ) ).toEqual( undefined ); } ); it( 'should return undefined when supplied border is empty', () => { expect( getSplitBorders( {} ) ).toEqual( undefined ); // Checking for extra resilience, even if not a valid type. - // @ts-expect-error + // @ts-expect-error Deliberately invalid input, to check runtime resilience. expect( getSplitBorders( nonBorder ) ).toEqual( undefined ); } ); @@ -208,7 +208,7 @@ describe( 'BorderBoxControl Utils', () => { it( 'should only return differences for border related properties', () => { // Checking for extra resilience, even if not a valid type. - // @ts-expect-error + // @ts-expect-error Deliberately invalid input, to check runtime resilience. const diff = getBorderDiff( nonBorder, { caffeine: 'coffee' } ); expect( diff ).toEqual( {} ); } ); @@ -218,7 +218,7 @@ describe( 'BorderBoxControl Utils', () => { ...completeBorder, color: '#21759b', // Checking for extra resilience, even if not a valid type. - // @ts-expect-error + // @ts-expect-error Deliberately invalid input, to check runtime resilience. caffeine: 'cola', } ); expect( diff ).toEqual( { color: '#21759b' } ); @@ -317,7 +317,7 @@ describe( 'BorderBoxControl Utils', () => { expect( getShorthandBorderStyle( undefined ) ).toEqual( undefined ); expect( getShorthandBorderStyle( {} ) ).toEqual( undefined ); // Checking for extra resilience, even if not a valid type. - // @ts-expect-error + // @ts-expect-error Deliberately invalid input, to check runtime resilience. expect( getShorthandBorderStyle( nonBorder ) ).toEqual( undefined ); } ); diff --git a/packages/components/src/button/test/index.tsx b/packages/components/src/button/test/index.tsx index 6167d4a6daa3a1..7a3e7a1a102b4a 100644 --- a/packages/components/src/button/test/index.tsx +++ b/packages/components/src/button/test/index.tsx @@ -2,6 +2,7 @@ * External dependencies */ import { render, screen } from '@testing-library/react'; +import { press } from '@ariakit/test'; /** * WordPress dependencies @@ -15,7 +16,6 @@ import { plusCircle } from '@wordpress/icons'; import _Button from '..'; import Tooltip from '../../tooltip'; import cleanupTooltip from '../../tooltip/test/utils'; -import { press } from '@ariakit/test'; jest.mock( '../../icon', () => () =>
); @@ -636,9 +636,9 @@ describe( 'Button', () => {