node.js - 命名空间“Express”没有导出成员“SessionData”
问题描述
我正在尝试构建一个 typeScript 项目,但它有一个错误,我不知道它来自哪里,并且自上次以来没有任何变化。
node_modules/connect-mongo/src/types.d.ts:113:66 - error TS2694: Namespace 'Express' has no exported member 'SessionData'.
113 get: (sid: string, callback: (err: any, session: Express.SessionData | null) => void) => void;
~~~~~~~~~~~
node_modules/connect-mongo/src/types.d.ts:114:45 - error TS2694: Namespace 'Express' has no exported member 'SessionData'.
114 set: (sid: string, session: Express.SessionData, callback?: (err: any) => void) => void;
~~~~~~~~~~~
node_modules/connect-mongo/src/types.d.ts:118:47 - error TS2694: Namespace 'Express' has no exported member 'SessionData'.
118 touch: (sid: string, session: Express.SessionData, callback?: (err: any) => void) => void;
~~~~~~~~~~~
src/controllers/http/auth/auth.ts:16:44 - error TS2339: Property 'user' does not exist on type 'Session & Partial<SessionData>'.
16 if (req.session && req.session.user) {
~~~~
src/controllers/http/auth/auth.ts:41:29 - error TS2339: Property 'user' does not exist on type 'Session & Partial<SessionData>'.
41 req.session.user = user;
~~~~
解决方案
我恢复到这个版本来解决这个问题: “@types/express-session”:“1.15.16”,
推荐阅读
- git - 如何 git 撤消合并文件
- c# - 程序在没有任何东西的情况下关闭 C#
- html - Flex如何显示保持垂直对齐的项目表
- regex - 尝试匹配以 ly 结尾但不是比较/最高级形式的副词
- drop-down-menu - 如何将下拉按钮中的列表大小固定为数字并使其在颤动中可滚动?
- java - Observer - 围绕电子邮件接收逻辑的可观察模型
- json - 从 JSON 检索值到经典 ASP
- angular - 有没有办法在 Angular 7 中命名路线?
- mysql - UNION ALL LEFT JOIN 和 SUM 返回不正确的值
- selenium - 使用无头时 Selenium 数据目录出错