Skip to content

Commit 9512de7

Browse files
committed
fix: ts issue in the useQuery client response
1 parent a57dc33 commit 9512de7

4 files changed

Lines changed: 5 additions & 2 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,14 @@ import "client-only";
124124

125125
import { envs } from "~/envs";
126126
import { createTrpcQueryClient } from "@creatorem/next-trpc/query-client";
127+
import { useQuery } from "@tanstack/react-query";
127128
import { type AppRouter } from "./router";
128129

129130
const url = envs().NEXT_PUBLIC_YOUR_APP_URL + "/api/trpc";
130131

131132
export const clientTrpc = createTrpcQueryClient<AppRouter>({
132133
url,
134+
useQuery,
133135
headers: async () => {
134136
// add custom headers like Authorization to make it works with auth logic
135137
return {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@creatorem/next-trpc",
3-
"version": "1.0.9",
3+
"version": "1.0.10",
44
"repository": {
55
"type": "git",
66
"url": "git+https://github.com/creatorem/next-trpc"

src/create-trpc-api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export const createTrpcAPI = <Ctx>({
4141
{ status: 400 }
4242
);
4343
}
44+
4445
if (!params.trpc) {
4546
return NextResponse.json(
4647
{

src/create-trpc-query-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type TrpcClientWithQuery<R extends Router<any>> = {
1717
"queryKey" | "queryFn"
1818
>
1919
) => ReturnType<
20-
typeof useQueryType<Output, Error, Output, string[]>
20+
typeof useQueryType<Awaited<Output>, Error, Awaited<Output>, string[]>
2121
>;
2222
}
2323
: never;

0 commit comments

Comments
 (0)