jack
jack
TtRPC
Created by jack on 10/24/2023 in #❓-help
error route always getting 500 from trpc error? (next13/approuter)
Bumping this. Cant figure it out for the life of me
2 replies
TtRPC
Created by jack on 2/1/2023 in #❓-help
type mismatch between tRPC return (in sveltekit) and defined type
gotcha, thanks for the help
13 replies
TtRPC
Created by jack on 2/1/2023 in #❓-help
type mismatch between tRPC return (in sveltekit) and defined type
i added to both just to be safe
13 replies
TtRPC
Created by jack on 2/1/2023 in #❓-help
type mismatch between tRPC return (in sveltekit) and defined type
seems like it has something to do with server vs client, but im not entirely clear on whats happening here
13 replies
TtRPC
Created by jack on 2/1/2023 in #❓-help
type mismatch between tRPC return (in sveltekit) and defined type
yea, thanks! quick question: I just followed the docs surrounding how to add superjson, but the sveltekit trpc setup is a bit different that that in the regular docs. not sure if this is enough context, but do I need to add the transformer on both client initializations here?
export function trpc(init?: TRPCClientInit) {
if (typeof window === 'undefined')
return createTRPCClient<Router>({ init, transformer: superjson });
if (!browserClient) browserClient = createTRPCClient<Router>({ transformer: superjson });
return browserClient;
}
export function trpc(init?: TRPCClientInit) {
if (typeof window === 'undefined')
return createTRPCClient<Router>({ init, transformer: superjson });
if (!browserClient) browserClient = createTRPCClient<Router>({ transformer: superjson });
return browserClient;
}
13 replies
TtRPC
Created by jack on 2/1/2023 in #❓-help
type mismatch between tRPC return (in sveltekit) and defined type
ok, added superjson; seems like it'll make things a fair bit easier
13 replies
TtRPC
Created by jack on 2/1/2023 in #❓-help
type mismatch between tRPC return (in sveltekit) and defined type
now that i look at it closer, im assuming that the Date type when returned from trpc is string, but still Date on the actual type imported from the prisma client ?
13 replies
TtRPC
Created by jack on 2/1/2023 in #❓-help
type mismatch between tRPC return (in sveltekit) and defined type
not entirely sure if i have a transformer, i mostly tried to follow the instructions here: https://icflorescu.github.io/trpc-sveltekit/, but then i added my prisma client onto the context. error is:
Type 'SerializeObject<UndefinedToOptional<Card & { tasks: Task[]; }>>' is not assignable to type 'Card & Task[]'.
Type 'SerializeObject<UndefinedToOptional<Card & { tasks: Task[]; }>>' is not assignable to type 'Card'.
Types of property 'createdAt' are incompatible.
Type 'string' is not assignable to type 'Date'.
Type 'SerializeObject<UndefinedToOptional<Card & { tasks: Task[]; }>>' is not assignable to type 'Card & Task[]'.
Type 'SerializeObject<UndefinedToOptional<Card & { tasks: Task[]; }>>' is not assignable to type 'Card'.
Types of property 'createdAt' are incompatible.
Type 'string' is not assignable to type 'Date'.
13 replies