How to fix WebStorm not recognizing some Node.js Express properties?

前端 未结 1 978
旧时难觅i
旧时难觅i 2021-02-01 18:10

After execute express mysite and ``npm install -d` I opened the generated directory with WebStorm, the following Express methods aren\'t recognized by the IDE:

1条回答
  •  清歌不尽
    2021-02-01 18:57

    This applies to almostly any JS project out there. You should explicitly define an object's properties or write JSDocs:

    /**
     * @memberOf   myLib
     * or
     * @name       myLib.MyDynamicallyLoadedModule
     */
    var MyDynamicallyLoadedModule = {};
    

    Otherwise, WebStorm cannot understand that you have dynamic properties.

    (yeah, I know you're refering to Express, but that's how WebStorm works)

    0 讨论(0)
提交回复
热议问题