mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
🚨 修复 qodana 报错
This commit is contained in:
6
src/types/BBS/Response.d.ts
vendored
6
src/types/BBS/Response.d.ts
vendored
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file types/BBS/Response.d.ts
|
||||
* @description BBS 返回数据类型定义文件
|
||||
* @since Beta v0.3.6
|
||||
* @since Beta v0.3.9
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -14,14 +14,14 @@ declare namespace TGApp.BBS.Response {
|
||||
/**
|
||||
* @description 基础返回类型,设计米游社接口请求都是这个类型
|
||||
* @interface Base
|
||||
* @since Beta v0.3.5
|
||||
* @since Beta v0.3.9
|
||||
* @property {never} retcode - 响应代码
|
||||
* @property {string} message - 响应消息
|
||||
* @property {never} data - 响应数据
|
||||
* @return Base
|
||||
*/
|
||||
interface Base {
|
||||
retcode: never;
|
||||
retcode: number;
|
||||
message: string;
|
||||
data: never;
|
||||
}
|
||||
|
||||
8
src/types/Plugins/JSBridge.d.ts
vendored
8
src/types/Plugins/JSBridge.d.ts
vendored
@@ -35,14 +35,6 @@ declare namespace TGApp.Plugins.JSBridge {
|
||||
*/
|
||||
type NullArg = Arg<null>;
|
||||
|
||||
/**
|
||||
* @description 通用 arg 参数-未知参数
|
||||
* @since Beta v0.3.9
|
||||
* @interface UnknownArg
|
||||
* @return UnknownArg
|
||||
*/
|
||||
type UnknownArg = Arg<unknown>;
|
||||
|
||||
/**
|
||||
* @description configShare 方法参数
|
||||
* @since Beta v0.3.9
|
||||
|
||||
@@ -173,7 +173,7 @@ class TGClient {
|
||||
* @returns {Promise<void>} - 返回值
|
||||
*/
|
||||
async handleCallback(arg: Event<string>): Promise<void> {
|
||||
const argParse: TGApp.Plugins.JSBridge.UnknownArg = JSON.parse(<string>arg.payload);
|
||||
const argParse: TGApp.Plugins.JSBridge.Arg<any> = JSON.parse(<string>arg.payload);
|
||||
if (argParse.method.startsWith("teyvat")) {
|
||||
await this.handleCustomCallback(argParse);
|
||||
return;
|
||||
@@ -271,16 +271,16 @@ class TGClient {
|
||||
* @func handleCustomCallback
|
||||
* @since Beta v0.3.9
|
||||
* @desc 处理自定义的 callback
|
||||
* @param {TGApp.Plugins.JSBridge.UnknownArg} arg - 事件参数
|
||||
* @param {TGApp.Plugins.JSBridge.Arg<any>} arg - 事件参数
|
||||
* @returns {Promise<void>} - 返回值
|
||||
*/
|
||||
async handleCustomCallback(arg: TGApp.Plugins.JSBridge.UnknownArg): Promise<void> {
|
||||
async handleCustomCallback(arg: TGApp.Plugins.JSBridge.Arg<any>): Promise<void> {
|
||||
switch (arg.method) {
|
||||
case "teyvat_open":
|
||||
createPost(<string>arg.payload);
|
||||
break;
|
||||
default:
|
||||
console.warn(`[customCallback] ${arg.payload}`);
|
||||
console.warn(`[customCallback] ${arg.method}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user