From 1d8479c063ab637ffc22a5433c7b65663bd9554a Mon Sep 17 00:00:00 2001 From: imbytecat Date: Sun, 18 Jan 2026 03:26:26 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=BB=9F=E4=B8=80=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E7=AB=AF=E7=B1=BB=E5=9E=8B=E5=AE=9A=E4=B9=89=E5=B9=B6?= =?UTF-8?q?=E5=A2=9E=E5=BC=BA=E7=B1=BB=E5=9E=8B=E4=B8=80=E8=87=B4=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 更新客户端类型以使用定义的 APIClient 类型并确保类型一致性 - 添加类型定义以导出基于路由配置的客户端类型。 --- src/orpc/client.ts | 5 +++-- src/orpc/types.ts | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 src/orpc/types.ts diff --git a/src/orpc/client.ts b/src/orpc/client.ts index b1b8915..43b22fc 100644 --- a/src/orpc/client.ts +++ b/src/orpc/client.ts @@ -5,6 +5,7 @@ import { createTanstackQueryUtils } from '@orpc/tanstack-query' import { createIsomorphicFn } from '@tanstack/react-start' import { getRequestHeaders } from '@tanstack/react-start/server' import { router } from './router' +import type { APIClient } from './types' const getORPCClient = createIsomorphicFn() .server(() => @@ -18,9 +19,9 @@ const getORPCClient = createIsomorphicFn() const link = new RPCLink({ url: `${window.location.origin}/api/rpc`, }) - return createORPCClient>(link) + return createORPCClient(link) }) -const client = getORPCClient() +const client: APIClient = getORPCClient() export const orpc = createTanstackQueryUtils(client) diff --git a/src/orpc/types.ts b/src/orpc/types.ts new file mode 100644 index 0000000..988dcbb --- /dev/null +++ b/src/orpc/types.ts @@ -0,0 +1,4 @@ +import type { RouterClient } from '@orpc/server' +import type { router } from './router' + +export type APIClient = RouterClient