Add Type information for JavaScript constant or variable in vs-code
Sep 7, 2018 · 1 min read
Write JavaScript with vs-code(except for the typescript), I find many variable or function argument’s type is ‘any’, and I can’t get the convenient from the strong IntelliSense.
After search it online, JSDoc comments is a solution for the problem. use ‘@param {type}’ to tag you function parameter’s type, use ‘@returns {type}’ to specify the return value of function, use ‘@type {type}’ to specify the type for a constant or a variable where the comment is placed. More information can read on the site below.
vs-code know the JSDoc comments, and provide a completion based on the variable you specify.
