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]
This commit is contained in:
Rostislav Wolny
2023-12-07 12:52:15 +01:00
committed by Aschepikov
parent 027e234b64
commit 8069ba320c

View File

@@ -70,9 +70,16 @@ declare module '@wordpress/preferences' {
// Types in @types/wordpress__notices are outdated and build on top of @types/wordpress__data // Types in @types/wordpress__notices are outdated and build on top of @types/wordpress__data
declare module '@wordpress/notices' { declare module '@wordpress/notices' {
import { StoreDescriptor } from '@wordpress/data/build-types/types'; 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<NoticeProps, 'children'> & {
id: string;
content: WPNotice['content'];
type: WPNotice['type'];
};
// We don't want to use the types from @types/wordpress__notices but the package // 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 // is installed anyway as a subdependency of @types/wordpress__components