我在为节点/快递项目添加类型方面有点蠢蠢欲动.
我正在使用TypeScript 2.2并表达4.x并且我通过npm安装了类型:
npm install --save-dev @types/express
import * as express from "express"
const app: express.Application = express()
app.get("/hello", (req, res) => {
res.send("world")
})
Run Code Online (Sandbox Code Playgroud)
这给了我:
src/app.ts(33,22): error TS7006: Parameter 'req' implicitly has an 'any' type.
src/app.ts(33,27): error TS7006: Parameter 'res' implicitly has an 'any' type.
Run Code Online (Sandbox Code Playgroud)
我试图避免为所有请求处理程序执行此操作:
(req: express.Request, res: express.Response) => {}
Run Code Online (Sandbox Code Playgroud)
在我看来它应该能够推断出那些.我错了吗?这不可能吗?
tsconfig.json:
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"noImplicitAny": true,
"sourceMap": true,
"outDir": "dist",
"typeRoots": ["src/types", "node_modules/@types"]
},
"include": [
"src/**/*.ts"
]
}
Run Code Online (Sandbox Code Playgroud)
谢谢!
使用Direct Runner在本地运行 Apache Beam 管道时,日志级别似乎设置为DEBUG.
有没有办法设置日志来INFO代替?
注意:--workerLogLevelOverrides可以在使用 Cloud Dataflow Runner 时使用,但似乎不适用于 Direct Runner