From d9f49f4c83d1f9c9a87bf99500eda225d77f4cc8 Mon Sep 17 00:00:00 2001 From: derek Date: Sun, 15 Jan 2023 14:05:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E5=A5=97=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- workflows/utils/notification-kit.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/workflows/utils/notification-kit.ts b/workflows/utils/notification-kit.ts index 9cab0700..df6c30a7 100644 --- a/workflows/utils/notification-kit.ts +++ b/workflows/utils/notification-kit.ts @@ -108,8 +108,8 @@ export class NotificationKit { * @param options */ async pushplus(options: PushPlusOptions) { - const token: string | undefined = env.PUSHPLUS_TOKEN; - if (typeof token !== "string") { + const token: string | unknown = env.PUSHPLUS_TOKEN; + if (token) { throw new Error("未配置PushPlus Token。"); } @@ -137,12 +137,12 @@ export class NotificationKit { * @param options */ async dingtalkWebhook(options: DingTalkOptions) { - const url: string | undefined = env.DINGDING_WEBHOOK; - if (typeof url !== "string") { + const url: string | unknown = env.DINGDING_WEBHOOK; + if (url) { throw new Error("未配置钉钉Webhook。"); } - return axios.post(url, { + return axios.post(url as string, { msgtype: "text", text: { content: `${options.title}\n${options.content}` @@ -156,12 +156,12 @@ export class NotificationKit { * @param options */ async wecomWebhook(options: WeComOptions) { - const url: string | undefined = env.WEIXIN_WEBHOOK; - if (typeof url !== "string") { + const url: string | unknown = env.WEIXIN_WEBHOOK; + if (url) { throw new Error("未配置企业微信Webhook。"); } - return axios.post(url, { + return axios.post(url as string, { msgtype: "text", text: { content: `${options.title}\n${options.content}`