Mr. Joker
Mr. Joker
TtRPC
Created by Mr. Joker on 3/6/2025 in #❓-help
I'm trying to get type for queries/mutations returned from trpc use hooks, but they are different
Thank you very much
7 replies
TtRPC
Created by Mr. Joker on 3/6/2025 in #❓-help
I'm trying to get type for queries/mutations returned from trpc use hooks, but they are different
Type '{ userQuery: UseTRPCQueryResult<{ success: boolean; user: { username: string; password: string; id: number; }; }, TRPCClientErrorLike<BuildProcedure<"query", { _config: RootConfig<{ ctx: { session: CustomSession; req: FastifyRequest<RouteGenericInterface, ... 6 more ..., ResolveFastifyRequestType<...>>; res: Fastify...' is not assignable to type 'AuthContextValue'.
Types of property 'userQuery' are incompatible.
Type 'UseTRPCQueryResult<{ success: boolean; user: { username: string; password: string; id: number; }; }, TRPCClientErrorLike<BuildProcedure<"query", { _config: RootConfig<{ ctx: { session: CustomSession; req: FastifyRequest<RouteGenericInterface, ... 6 more ..., ResolveFastifyRequestType<...>>; res: FastifyReply<...>; }...' is not assignable to type 'UseQueryResult<{ success: boolean; user: { username: string; password: string; id: number; }; }, Error>'.
Type 'TRPCHookResult & QueryObserverRefetchErrorResult<{ success: boolean; user: { username: string; password: string; id: number; }; }, TRPCClientErrorLike<BuildProcedure<"query", { _config: RootConfig<{ ctx: { session: CustomSession; req: FastifyRequest<...>; res: FastifyReply<...>; }; meta: object; errorShape: DefaultE...' is not assignable to type 'UseQueryResult<{ success: boolean; user: { username: string; password: string; id: number; }; }, Error>'.
Type 'TRPCHookResult & QueryObserverRefetchErrorResult<{ success: boolean; user: { username: string; password: string; id: number; }; }, TRPCClientErrorLike<BuildProcedure<"query", { _config: RootConfig<{ ctx: { session: CustomSession; req: FastifyRequest<...>; res: FastifyReply<...>; }; meta: object; errorShape: DefaultE...' is not assignable to type 'QueryObserverRefetchErrorResult<{ success: boolean; user: { username: string; password: string; id: number; }; }, Error>'.
Types of property 'error' are incompatible.
Type '{ userQuery: UseTRPCQueryResult<{ success: boolean; user: { username: string; password: string; id: number; }; }, TRPCClientErrorLike<BuildProcedure<"query", { _config: RootConfig<{ ctx: { session: CustomSession; req: FastifyRequest<RouteGenericInterface, ... 6 more ..., ResolveFastifyRequestType<...>>; res: Fastify...' is not assignable to type 'AuthContextValue'.
Types of property 'userQuery' are incompatible.
Type 'UseTRPCQueryResult<{ success: boolean; user: { username: string; password: string; id: number; }; }, TRPCClientErrorLike<BuildProcedure<"query", { _config: RootConfig<{ ctx: { session: CustomSession; req: FastifyRequest<RouteGenericInterface, ... 6 more ..., ResolveFastifyRequestType<...>>; res: FastifyReply<...>; }...' is not assignable to type 'UseQueryResult<{ success: boolean; user: { username: string; password: string; id: number; }; }, Error>'.
Type 'TRPCHookResult & QueryObserverRefetchErrorResult<{ success: boolean; user: { username: string; password: string; id: number; }; }, TRPCClientErrorLike<BuildProcedure<"query", { _config: RootConfig<{ ctx: { session: CustomSession; req: FastifyRequest<...>; res: FastifyReply<...>; }; meta: object; errorShape: DefaultE...' is not assignable to type 'UseQueryResult<{ success: boolean; user: { username: string; password: string; id: number; }; }, Error>'.
Type 'TRPCHookResult & QueryObserverRefetchErrorResult<{ success: boolean; user: { username: string; password: string; id: number; }; }, TRPCClientErrorLike<BuildProcedure<"query", { _config: RootConfig<{ ctx: { session: CustomSession; req: FastifyRequest<...>; res: FastifyReply<...>; }; meta: object; errorShape: DefaultE...' is not assignable to type 'QueryObserverRefetchErrorResult<{ success: boolean; user: { username: string; password: string; id: number; }; }, Error>'.
Types of property 'error' are incompatible.
7 replies
TtRPC
Created by Mr. Joker on 3/2/2025 in #❓-help
[Typescript] Client query/mutate has any type
My problem lies in my project's monorepo architecture and reexporting schemas within monorepo and then infering types with zod
5 replies
TtRPC
Created by Mr. Joker on 3/2/2025 in #❓-help
[Typescript] Client query/mutate has any type
UPD: I've read the article https://trpc.io/docs/faq#it-doesnt-work-im-getting-any-everywhere, I have everything allright with the list, still having the issue
5 replies
TtRPC
Created by Mr. Joker on 3/1/2025 in #❓-help
[Help] Fastify session http only cookie differs
The problem is probably with fastify/fastify session plugin. fastify.register(session, { secret: "supersecret1234567890supersecret1234567890", // Use a strong secret here for production. cookie: { secure: "auto", // THIS WORKED 👍 (Even though 'auto' must set secure to false if http localhost) secure: false, // THIS DIDN'T WORK 👎 httpOnly: true, maxAge: 1000 * 60 * 60 * 24, sameSite: process.env.NODE_ENV === "production" ? "strict" : "none", }, saveUninitialized: false, });
4 replies