【问题标题】:Could not find a declaration file for module 'rxjs'找不到模块“rxjs”的声明文件
【发布时间】:2022-07-26 17:11:33
【问题描述】:

我将 rxjs 与 typescript 一起使用,但我得到了下一个错误

Could not find a declaration file for module 'rxjs'.'C:/Path/to/project/node_modules/rxjs/dist/cjs/index.js'

typescript version 4.7.4 

rxjs version 7.5.6

working with vscode 1.59

我创建了新的 Angular 14 应用程序。 为了解决这个问题,我尝试升级 typescript 版本,就像我在 github 问题中看到的那样,它在 typescript 4.2 及更高版本之后解决了 但我仍然有错误

如何解决版本问题?

【问题讨论】:

    标签: typescript rxjs


    【解决方案1】:

    该错误仅显示在 vscode 上,而不显示在终端的 tsc 上。 所以我知道问题出在 vscode typescript internal server. 中。它有较旧的打字稿版本,然后 rxjs 7 需要.... 所以我将vscode版本升级到1.69并解决了

    您也可以手动更改 vscode ts 版本 看到这个答案 What TypeScript version is Visual Studio Code using? How to update it?

    【讨论】:

      猜你喜欢
      • 2021-07-24
      • 2017-08-13
      • 1970-01-01
      • 2021-01-02
      • 2019-04-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多