context assert error "Assertions require every name in the call target to be declared with an explicit type annotation" #446
Answered
by
kitsonk
nameOfUser0236
asked this question in
Q&A
-
oak's context's assert function generates the following error: import * as oak from "https://deno.land/x/oak/mod.ts";
const app = new oak.Application();
app.use((ctx) => {
ctx.assert(true);
});
await app.listen({ port: 8000 }); I suspect that it is because the condition is any. |
Beta Was this translation helpful? Give feedback.
Answered by
kitsonk
Jan 9, 2022
Replies: 1 comment 1 reply
-
This is a design limitation of TypeScript (see: microsoft/TypeScript#36931). You need to do something like: import * as oak from "https://deno.land/x/oak/mod.ts";
import type { Context } from "https://deno.land/x/oak/mod.ts";
const app = new oak.Application();
app.use((ctx: Context) => {
ctx.assert(true);
});
await app.listen({ port: 8000 }); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
nameOfUser0236
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a design limitation of TypeScript (see: microsoft/TypeScript#36931).
You need to do something like: