如何使用typescript / jsdoc添加描述以键入键/常量?

时间:2019-09-20 11:52:09

标签: typescript jsdoc

我有一个如下所示的类型定义:

export type Directions = 'UP' | 'DOWN' | 'LEFT' | 'RIGHT';
export type LookAt = {
  direction: Directions;
};

自动完成看起来像这样:
enter image description here

但是我想为每个属性添加描述:

export type Directions =
  /**
   * By looking up the item will be automatically attached to the top
   */
  | 'UP'
  /**
   * By looking down the item will be automatically attached to the bottom
   */
  | 'DOWN'
  /**
   * By looking left the item will be automatically attached to the left
   */
  | 'LEFT'
  /**
   * By looking right the item will be automatically attached to the right
   */
  | 'RIGHT';

但是自动填充功能不会显示项目说明,而只会显示属性名称

enter image description here

如何添加关于这种情况的描述?

0 个答案:

没有答案