Kaynağa Gözat

♻️ refactor(rpc-client): 优化RPC客户端类型定义

- 为`rpcClient`函数添加泛型约束`<T extends any>`以明确类型参数
- 添加`// @ts-ignore`注释以临时处理类型检查问题
- 添加函数注释说明其用途为创建Hono RPC客户端
yourname 1 gün önce
ebeveyn
işleme
b5209be06f

+ 3 - 1
mini-ui-packages/mini-shared-ui-components/src/utils/rpc/rpc-client.ts

@@ -192,7 +192,9 @@ const taroFetch = async (input: RequestInfo | URL, init?: RequestInit): Promise<
   }
 }
 
-export const rpcClient = <T>(apiBasePath?: string): ReturnType<typeof hc<T>> => {
+// 创建Hono RPC客户端
+export const rpcClient = <T extends any>(apiBasePath?: string) => {
+  // @ts-ignore
   return hc<T>(`${API_BASE_URL}${apiBasePath}`, {
     fetch: taroFetch
   })