You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How can I pass the specific context type from /register-user to my registerUser()? The default type c: Context results in a type error on valid("json")
app.post("/register-user",zValidator("json",registerUserReqSchema),registerUser);asyncfunctionregisterUser(c: Context){constvalidBody=c.req.valid("json");// Argument of type 'string' is not assignable to parameter of type 'never'.ts(2345)constbody=awaitc.req.json<NewUserReq>();// works correctly}
also tried to infer from c
auth.post("/register-user",zValidator("json",registerUserReqSchema),async(c)=>registerUser(c));// c type for /register-user//(parameter) c: Context<{}, "/register-user", {// in: {// json: {// email: string,// username: string;// };// };// out: {// ...;// };// }>
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
How can I pass the specific context type from
/register-user
to myregisterUser()
? The default typec: Context
results in a type error onvalid("json")
also tried to infer from c
Beta Was this translation helpful? Give feedback.
All reactions