用于解构参数的JSDoc注释在VSCode中不起作用 [英] JSDoc comments for destructuring parameters not working in VSCode

查看:825
本文介绍了用于解构参数的JSDoc注释在VSCode中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据文档,JSDoc支持解构参数:

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 }) {
    // ...
};

但是,它在VSCode(v1.23.1)中对我不起作用.有人成功尝试过吗?

However, it doesn't work for me in VSCode (v1.23.1). Has anyone successfully tried this?

VSCode和TypeScript存储库包含有关类似问题的几篇文章,但它们令人困惑且封闭(例如这里).

VSCode and TypeScript repos contain several posts about similar issues, but they are confusing and closed (example here).

推荐答案

仅VSCode 1.24(TypeScript 2.9)支持此功能.

This feature is supported from VSCode 1.24 only (TypeScript 2.9).

截至目前的情况(VSCode 1.24.0):

Situation as of now (VSCode 1.24.0):

  • 参数类型正确解析,允许类型检查.
  • 参数描述文本未显示在IntelliSense中(问题已报告此处)
  • Param type is parsed correctly, allowing for type checking.
  • Param description text doesn't show up in IntelliSense (issue reported here).

这篇关于用于解构参数的JSDoc注释在VSCode中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆