westorm中使用express出现unresolved function or method

问题描述

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

解决办法

官网给出的方法

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

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