From 9bcf6ee48d1177e5027a4f97e56cd23173682c5d Mon Sep 17 00:00:00 2001 From: IndieKKY Date: Sun, 6 Oct 2024 18:59:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/messaging/layer2/InjectMessaging.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/messaging/layer2/InjectMessaging.ts b/src/messaging/layer2/InjectMessaging.ts index 5b14346..a62a692 100644 --- a/src/messaging/layer2/InjectMessaging.ts +++ b/src/messaging/layer2/InjectMessaging.ts @@ -6,7 +6,7 @@ class InjectMessaging { l1protocol?: Layer1Protocol //类实例 methods?: { - [key: string]: (params: any, context: MethodContext) => Promise + [K in AllInjectMessages['method']]: (params: Extract['params'], context: MethodContext) => Promise } debug = (...args: any[]) => { @@ -23,7 +23,7 @@ class InjectMessaging { // message: 'Target Error: ' + req.target, // }) - const method = this.methods?.[req.method] + const method = this.methods?.[req.method as keyof typeof this.methods] if (method != null) { return method(req.params, { from: req.from,