From 833a7ee8ec991de85fc5bade164e9a52a2a2a0a9 Mon Sep 17 00:00:00 2001 From: Linxzh Date: Fri, 3 Mar 2023 09:46:53 +0800 Subject: [PATCH 1/3] fix: update type error in template code --- src/modules/examples.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/examples.ts b/src/modules/examples.ts index d5d7eed..63e2bf3 100644 --- a/src/modules/examples.ts +++ b/src/modules/examples.ts @@ -26,14 +26,14 @@ export class BasicExampleFactory { notify: async ( event: string, type: string, - ids: Array, + ids: number[] | string[], extraData: { [key: string]: any } ) => { if (!addon?.data.alive) { this.unregisterNotifier(notifierID); return; } - addon.hooks.onNotify(event, type, ids, extraData); + addon.hooks.onNotify(event, type, ids as string[], extraData); }, }; From b0010ee8c7746c419a3aed17f79db296bf028ca0 Mon Sep 17 00:00:00 2001 From: Linxzh Date: Fri, 3 Mar 2023 15:08:13 +0800 Subject: [PATCH 2/3] fix: Update type in hooks, match the variable types between examples.ts and hooks.ts --- src/hooks.ts | 2 +- src/modules/examples.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hooks.ts b/src/hooks.ts index c8e8fe3..ef7f161 100644 --- a/src/hooks.ts +++ b/src/hooks.ts @@ -91,7 +91,7 @@ function onShutdown(): void { async function onNotify( event: string, type: string, - ids: Array, + ids: Array | Array, extraData: { [key: string]: any } ) { // You can add your code to the corresponding notify type diff --git a/src/modules/examples.ts b/src/modules/examples.ts index 63e2bf3..b780884 100644 --- a/src/modules/examples.ts +++ b/src/modules/examples.ts @@ -33,7 +33,7 @@ export class BasicExampleFactory { this.unregisterNotifier(notifierID); return; } - addon.hooks.onNotify(event, type, ids as string[], extraData); + addon.hooks.onNotify(event, type, ids, extraData); }, }; From f625f326eb4f014ec96f8f7ab7d46a086e2220f1 Mon Sep 17 00:00:00 2001 From: Linxzh Date: Sun, 5 Mar 2023 13:51:08 +0800 Subject: [PATCH 3/3] Update src/hooks.ts Co-authored-by: volatile-static <1043064987@qq.com> --- src/hooks.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks.ts b/src/hooks.ts index ef7f161..cbd180c 100644 --- a/src/hooks.ts +++ b/src/hooks.ts @@ -91,7 +91,7 @@ function onShutdown(): void { async function onNotify( event: string, type: string, - ids: Array | Array, + ids: Array, extraData: { [key: string]: any } ) { // You can add your code to the corresponding notify type