typescript - 输入 express &nestjs,启动项目报错
问题描述
我正在使用nestJS。当我启动项目时,出现以下错误。@types/express 包有问题吗?还是我做错了什么?谢谢。
[14:17:06] Starting compilation in watch mode...
node_modules/@types/express/index.d.ts:99:42 - error TS2344: Type 'P' does not satisfy the constraint 'Params'.
Type 'P' is not assignable to type 'ParamsArray'.
extends core.ErrorRequestHandler<P, ResBody, ReqBody, ReqQuery> { }
~
node_modules/@types/express/index.d.ts:108:124 - error TS2344: Type 'P' does not satisfy the constraint 'Params'.
Type 'P' is not assignable to type 'ParamsArray'.
interface Request<P = core.ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = core.Query> extends core.Request<P, ResBody, ReqBody, ReqQuery> { }
node_modules/@types/express/index.d.ts:109:138 - error TS2344: Type 'P' does not satisfy the constraint 'Params'.
Type 'P' is not assignable to type 'ParamsArray'.
interface RequestHandler<P = core.ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = core.Query> extends core.RequestHandler<P, ResBody, ReqBody, ReqQuery> { }
[14:17:17] Found 3 errors. Watching for file changes.
解决方案
我在编译时遇到了同样的问题,尽管只是删除package-lock.json
对我不起作用。但是,这样做了:npm update @types/express-serve-static-core --depth 1
...在链接的问题中提出了建议
推荐阅读
- react-native - 将 gradle 版本从 2.2.3 更新到 3.0.1 会破坏 react-native-mailcore 库
- pdfbox - 字体 ArialMT 中使用的 OpenType 布局表未在 PDFBox 中实现
- neo4j - Neo4j Cypher 如何在 APOC neo4j cypher 查询中包含另一个父关系节点
- arrays - 如何将数组中的数据推送到对象中?
- c++ - 使用模板重载运算符
- hyperledger-fabric - 创建参与者的问题和身份问题 - 授权失败
- sql - 员工表 - 带有一些警告的层次结构
- ssl - 强制 Chrome 在 TLS 期间发送链中的所有证书
- angular - Angular 4 Highcharts - 需要在项目之间放置边距
- vba - 如何在同一个 Sub 中过滤、计数和循环