我有这个简单的 server.ts 文件。
import { Application, Router } from "https://deno.land/x/oak/mod.ts";
const app = new Application();
const router = new Router();
router
.get("/",(ctx) => {
ctx.response.body = "Router has been created";
// Implement your code
});
app.use(router.routes());
app.use(router.allowedMethods());
app.listen({port:8000});
我使用命令运行此应用程序:
deno run --allow-net server.ts
它抛出此错误:
error: TS2376 [ERROR]: A 'super' call must be the first statement in the constructor when a class contains initialized properties, parameter properties, or private identifiers.
constructor(
^
at https://deno.land/x/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d3bcb2b893a5e4fde7fde3" rel="noreferrer noopener nofollow">[email protected]</a>/range.ts:102:3
我只想将 deno 与 Oak 一起使用,而不是与内部 deno 的东西进行斗争。我有什么遗漏的吗?
谢谢!
最佳答案
将 deno 升级到 1.9.2 然后再升级到较低版本 1.6.2 1.6.0 1.8.3 后也遇到同样的情况
只需将您的版本升级到 1.9.2。您将被排序
关于typescript - 为什么我会收到此消息(错误 : TS2376) while running oak.?正文中的错误详细信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67447734/