问题
According to the doc, JSDoc supports destructuring parameters:
/**
* Assign the project to an employee.
* @param {Object} employee - The employee who is responsible for the project.
* @param {string} employee.name - The name of the employee.
* @param {string} employee.department - The employee's department.
*/
Project.prototype.assign = function({ name, department }) {
// ...
};
However, it doesn't work for me in VSCode (v1.23.1). Has anyone successfully tried this?
VSCode and TypeScript repos contain several posts about similar issues, but they are confusing and closed (example here).
回答1:
This feature is supported from VSCode 1.24 only (TypeScript 2.9).
Situation as of now (VSCode 1.24.0):
- Param type is parsed correctly, allowing for type checking.
- Param description text doesn't show up in IntelliSense (issue reported here).
来源:https://stackoverflow.com/questions/50655416/jsdoc-comments-for-destructuring-parameters-not-working-in-vscode