【发布时间】:2020-02-29 08:03:36
【问题描述】:
Typescript 抛出请求在类型 BaseContext 中不存在的错误消息。那不可能是因为我之前使用过代码并且它有效。
“BaseContext”类型上不存在属性“请求”。
import { BaseContext } from 'koa'
export function handle(ctx: BaseContext) {
ctx.body = ctx.request.body
}
tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"esModuleInterop": true,
"target": "es2017",
"noImplicitAny": true,
"moduleResolution": "node",
"sourceMap": true,
"outDir": "dist",
"baseUrl": "."
},
"include": ["src/**/*", "env/**/*"]
}
【问题讨论】:
标签: node.js typescript koa