hono rpc problem
Type 'Hono<Context, BlankSchema | MergeSchemaPath<{ "/signup": { $post: { input: { form: { username: string; password: string; }; }; output: { success: true; message: string; }; outputFormat: "json"; status: ContentfulStatusCode; }; }; } & { ...; } & { ...; } & { ...; }, "/api/auth"> | MergeSchemaPath<...> | MergeSchemaPa...' does not satisfy the constraint 'Hono<any, any, any>'.
The types of 'get(...).get(...).getPath' are incompatible between these types.
Type 'GetPath<Context>' is not assignable to type 'GetPath<{}>'.
Types of parameters 'options' and 'options' are incompatible.
Type '{ env?: unknown; } | undefined' is not assignable to type '{ env?: object | undefined; } | undefined'.
Type '{ env?: unknown; }' is not assignable to type '{ env?: object | undefined; }'.
Types of property 'env' are incompatible.
Type 'unknown' is not assignable to type 'object | undefined'. (ts 2344)Type 'Hono<Context, BlankSchema | MergeSchemaPath<{ "/signup": { $post: { input: { form: { username: string; password: string; }; }; output: { success: true; message: string; }; outputFormat: "json"; status: ContentfulStatusCode; }; }; } & { ...; } & { ...; } & { ...; }, "/api/auth"> | MergeSchemaPath<...> | MergeSchemaPa...' does not satisfy the constraint 'Hono<any, any, any>'.
The types of 'get(...).get(...).getPath' are incompatible between these types.
Type 'GetPath<Context>' is not assignable to type 'GetPath<{}>'.
Types of parameters 'options' and 'options' are incompatible.
Type '{ env?: unknown; } | undefined' is not assignable to type '{ env?: object | undefined; } | undefined'.
Type '{ env?: unknown; }' is not assignable to type '{ env?: object | undefined; }'.
Types of property 'env' are incompatible.
Type 'unknown' is not assignable to type 'object | undefined'. (ts 2344)and this is the client code
const client = hc<ApiRoutes>("/", {
fetch: (input: RequestInfo | URL, init?: RequestInit) =>
fetch(input, {
...init,
credentials: "include",
}),
}).api.posts;const client = hc<ApiRoutes>("/", {
fetch: (input: RequestInfo | URL, init?: RequestInit) =>
fetch(input, {
...init,
credentials: "include",
}),
}).api.posts;for the context code
import type { Env } from "hono";
import type { Session, User } from "lucia";
export interface Context extends Env {
Variables: {
user: User | null;
session: Session | null;
};
}import type { Env } from "hono";
import type { Session, User } from "lucia";
export interface Context extends Env {
Variables: {
user: User | null;
session: Session | null;
};
}and how i've exported the type of App
const app = new Hono<Context>();
const routes = app
.basePath("/api")
.route("/auth", authRouter)
.route("/posts", postsRouter)
.route("/comments", commentsRouter);
export type ApiRoutes = typeof routes;const app = new Hono<Context>();
const routes = app
.basePath("/api")
.route("/auth", authRouter)
.route("/posts", postsRouter)
.route("/comments", commentsRouter);
export type ApiRoutes = typeof routes;