Update createNotice type

This commit is contained in:
Chi-Hsuan Huang 2022-05-20 14:43:38 +08:00
parent 16bb4b633a
commit 5187c07e9e
1 changed files with 13 additions and 22 deletions

View File

@ -56,29 +56,20 @@ export type Options = {
export function createNotice( export function createNotice(
status: Status = DEFAULT_STATUS, status: Status = DEFAULT_STATUS,
content: string, content: string,
{ options: Partial< Options > = {}
speak,
isDismissible,
context,
id,
actions,
type,
__unstableHTML,
icon,
explicitDismiss,
onDismiss,
}: Options = {
speak: true,
isDismissible: true,
context: DEFAULT_CONTEXT,
id: uniqueId( DEFAULT_CONTEXT ),
actions: [],
type: 'default',
icon: null,
explicitDismiss: false,
onDismiss: null,
}
) { ) {
const {
speak = true,
isDismissible = true,
context = DEFAULT_CONTEXT,
id = uniqueId( DEFAULT_CONTEXT ),
actions = [],
type = 'default',
__unstableHTML = false,
icon = null,
explicitDismiss = false,
onDismiss = null,
} = options;
// The supported value shape of content is currently limited to plain text // The supported value shape of content is currently limited to plain text
// strings. To avoid setting expectation that e.g. a WPElement could be // strings. To avoid setting expectation that e.g. a WPElement could be
// supported, cast to a string. // supported, cast to a string.