Weird error in trpc procedure

I am writing a simple create mutation but im getting some weird ts error. I tried restarting the ts server but no luck
export const postRouter = createTRPCRouter({
create: protectedProcedure
.input(
z.object({
text: z.string().emoji().min(1),
})
)
.mutation(async ({ ctx, input }) => {
const authorId = ctx.session.user.id;

const post = await ctx.prisma.post.create({
data: {
authorId,
text: input.text,
},
});

return post;
}),
});
export const postRouter = createTRPCRouter({
create: protectedProcedure
.input(
z.object({
text: z.string().emoji().min(1),
})
)
.mutation(async ({ ctx, input }) => {
const authorId = ctx.session.user.id;

const post = await ctx.prisma.post.create({
data: {
authorId,
text: input.text,
},
});

return post;
}),
});
8 Replies
whatplan
whatplan2y ago
its an eslint error not ts Ive had this problem recently too where ts has everything right but eslint says theres anys when theyre arent probably some eslint config changes you can try also restarting eslint server
aditya
adityaOP2y ago
im using the same eslint config which comes with create t3 app eslint is useful but pain in the ass
taff
taff2y ago
try restarting both eslint and ts servers when this happens usually resolves the problem
aditya
adityaOP2y ago
well I opened the editor again and it works is this the only way??
whizzy
whizzy2y ago
Yeah kinda in vs code you can type ‘>’ on the top search bar and find restart typescript server to restart, just 2 mins work !! Just takes 10 secs
thevalorised
thevalorised2y ago
Sometimes restarting ts server is not enough and you might need to close / reopen vs code
deforestor
deforestor2y ago
Have you found a definitive fix for it by any chance?
whatplan
whatplan2y ago
no sorry
Want results from more Discord servers?
Add your server