From 8069ba320c1beff9b68ff3fb0c0c547fa9292a25 Mon Sep 17 00:00:00 2001 From: Rostislav Wolny Date: Thu, 7 Dec 2023 12:52:15 +0100 Subject: [PATCH] Fix types for Notices There is a mismatch between the WPNotice type and the WordPress/notice store and Notice defined in the components package. [MAILPOET-5714] --- mailpoet/assets/js/src/types/wordpress-modules.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mailpoet/assets/js/src/types/wordpress-modules.ts b/mailpoet/assets/js/src/types/wordpress-modules.ts index c0fcfb8aa2..e721c510b7 100644 --- a/mailpoet/assets/js/src/types/wordpress-modules.ts +++ b/mailpoet/assets/js/src/types/wordpress-modules.ts @@ -70,9 +70,16 @@ declare module '@wordpress/preferences' { // Types in @types/wordpress__notices are outdated and build on top of @types/wordpress__data declare module '@wordpress/notices' { import { StoreDescriptor } from '@wordpress/data/build-types/types'; - import { Notice } from '@wordpress/notices/index'; + import { NoticeProps } from '@wordpress/components/build-types/notice/types'; + import { WPNotice } from '@wordpress/notices/build-types/store/selectors'; - export * from '@wordpress/notices/index'; + export * from '@wordpress/notices'; + + type Notice = Omit & { + id: string; + content: WPNotice['content']; + type: WPNotice['type']; + }; // We don't want to use the types from @types/wordpress__notices but the package // is installed anyway as a subdependency of @types/wordpress__components