问题描述

在Webstorm中使用express的方法时出现unresolved function or method get()

webstorm中使用express的方法出现unresolved function or method

解决办法

官网给出的方法

这些属性是在运行时动态添加的,并没有在Express模块中定义,所以Webstorm无法使用静态分析而报错。可通过安装@types/express解决。

光标选中require('express')中的express,然后Alt+Enter,在弹出的窗口中选择Install TypeScript definitions for better type information,安装完成即可。

webstorm中使用express的方法出现unresolved function or method

这时候,再JavaScript的Libaries中就有了@types/express。若在别的项目中再次出现此类情况,只要将该库选上即可。

此类情况,只要将该库选上即可。

webstorm中使用express的方法出现unresolved function or method

相关文章:

  • 2021-09-19
  • 2021-05-21
  • 2022-12-23
  • 2021-11-29
  • 2021-10-19
  • 2021-05-14
  • 2021-08-25
  • 2022-12-23
猜你喜欢
  • 2021-10-08
  • 2022-12-23
  • 2021-04-09
  • 2022-12-23
  • 2021-11-10
  • 2021-12-28
  • 2021-10-18
相关资源
相似解决方案