useInfiniteQuery does not exist on appRouter t3-Stack Prisma

I'm using appRouter and trying to do pagination with useInfiniteQuery() but i've got the next typescript error: Property 'useInfiniteQuery' does not exist on type '{ query: Resolver<BuildProcedure<"query", { _config: RootConfig<{ ctx: { headers: Headers; db: PrismaClient<{ log: ("query" | "warn" | "error")[]; }, never, DefaultArgs>; session: Session | null; }; meta: object; errorShape: { ...; }; transformer: typeof SuperJSON; }>; ... 5 more ...; _output_out: unique symbol; } and I can't find anything about it. This is my code
const posts = await api.post.getAllPosts.useInfiniteQuery(
{
limit: 5,
},

{
getNextPageParam(lastPage) {
return lastPage.nextCursor;
},
},
);
const posts = await api.post.getAllPosts.useInfiniteQuery(
{
limit: 5,
},

{
getNextPageParam(lastPage) {
return lastPage.nextCursor;
},
},
);
and on the server
getAllPosts: publicProcedure
.input(
z.object({
limit: z.number().min(1).max(100).nullish(),
cursor: z.string().nullish(),
}),
)
.query(async ({ ctx, input }) => {
const limit = input.limit ?? 10; // Max number of posts allowed per page
const { cursor } = input;
const posts = await ctx.db.post.findMany({
include: { createdBy: true },
take: limit + 1, // fetch one more post than needed
cursor: cursor ? { id: cursor } : undefined,
orderBy: { createdAt: "desc" },
});
let nextCursor: typeof cursor | undefined = undefined;
const hasMore = posts.length > limit;
if (hasMore) {
// Remove the last item and use it as next cursor
const nextPost = posts.pop()!;
nextCursor = nextPost.id;
}
return { success: true, posts, nextCursor };
}),
getAllPosts: publicProcedure
.input(
z.object({
limit: z.number().min(1).max(100).nullish(),
cursor: z.string().nullish(),
}),
)
.query(async ({ ctx, input }) => {
const limit = input.limit ?? 10; // Max number of posts allowed per page
const { cursor } = input;
const posts = await ctx.db.post.findMany({
include: { createdBy: true },
take: limit + 1, // fetch one more post than needed
cursor: cursor ? { id: cursor } : undefined,
orderBy: { createdAt: "desc" },
});
let nextCursor: typeof cursor | undefined = undefined;
const hasMore = posts.length > limit;
if (hasMore) {
// Remove the last item and use it as next cursor
const nextPost = posts.pop()!;
nextCursor = nextPost.id;
}
return { success: true, posts, nextCursor };
}),