【发布时间】:2021-05-10 18:29:08
【问题描述】:
我有这个简单的 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/oak@v7.4.0/range.ts:102:3
我只想将 deno 与橡木一起使用,而不是与内部 deno 的东西斗争。我有什么遗漏的吗?
谢谢!
【问题讨论】:
-
你使用的是什么版本的 Deno? 1.9.0 中有一个小错误导致此错误随机发生
-
@StevenGuerrero 这是 deno v 1.8.3
标签: typescript backend deno oak