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
When using ctx.assert, you need to add a type annotation for the ctx variable:
constrouter=newRouter<AppState>();router.post("/channels/:id/threads",async(ctx)=>{ctx.assert(ctx.state.auth,403);// Assertions require every name in the call target to be declared with an explicit type annotation.deno-ts(2775)constid=ctx.params.id;// etc})
The naive way of getting this working is to annotate ctx: RouterContext. That looks like this:
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
-
When using
ctx.assert
, you need to add a type annotation for thectx
variable:The naive way of getting this working is to annotate
ctx: RouterContext
. That looks like this:This is pretty verbose, and also repeats itself. Is there a better way?
Beta Was this translation helpful? Give feedback.
All reactions