Intellisense from JSDoc not working for imported types in VSCode

岁酱吖の 提交于 2019-12-07 13:50:58

问题


When using a, ES2015 class as a type in JSDoc it does not appear to work correctly in files that import that class via a require statement.

While working within the same file that the class was defined in, everything works as expected (shown below).

While working within a different file the class appears to import correctly and show its constructor typing (shown below).

But when I try to use the class for typing (As done in the first image) it no longer considers my class as a valid type.

Here is the jsconfig I was using for this example

{
    "compilerOptions": {
        "target": "es6",
        "module": "commonjs",
        "allowSyntheticDefaultImports": true
    }
}

Am I just missing something in my setup or is this the expected behavior?


回答1:


This answer may be a bit late, but line 6 of your last image should read:

@param {ExampleType} exampleType

With a lower case "exampleType", since that's what the param is named in the function.



来源:https://stackoverflow.com/questions/40877203/intellisense-from-jsdoc-not-working-for-imported-types-in-vscode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!