From 09eb9766b3fee20f4b0654264ebe40c0c78b9ee8 Mon Sep 17 00:00:00 2001 From: zanllp Date: Sun, 11 Jul 2021 14:46:45 +0800 Subject: [PATCH] =?UTF-8?q?fix(notification):=20=E5=AE=8C=E5=96=84notifica?= =?UTF-8?q?tion=E7=B1=BB=E5=9E=8B=20(#4346)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/notification/index.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/notification/index.tsx b/components/notification/index.tsx index 21b573052..c6a8b712c 100644 --- a/components/notification/index.tsx +++ b/components/notification/index.tsx @@ -212,7 +212,7 @@ function notice(args: NotificationArgsProps) { ); } -const api: any = { +const apiBase = { open: notice, close(key: string) { Object.keys(notificationInstance).forEach(cacheKey => @@ -228,7 +228,11 @@ const api: any = { }, }; -['success', 'info', 'warning', 'error'].forEach(type => { +type NotificationApi = typeof apiBase & + Record) => void>; +const api = apiBase as any as NotificationApi; +const iconTypes: IconType[] = ['success', 'info', 'warning', 'error']; +iconTypes.forEach(type => { api[type] = args => api.open({ ...args,