如何在Typescript中使用jsdoc类型?

时间:2018-06-11 17:55:18

标签: typescript

我开始更新Chartist的绝对类型中的类型定义。我最近意识到Chartist充满了类型参数的JsDoc,如下所示:

 /**
   * Chartist.Svg creates a new SVG object wrapper with a starting element. You can use the wrapper to fluently create sub-elements and modify them.
   *
   * @memberof Chartist.Svg
   * @constructor
   * @param {String|Element} name The name of the SVG element to create or an SVG dom element which should be wrapped into Chartist.Svg
   * @param {Object} attributes An object with properties that will be added as attributes to the SVG element that is created. Attributes with undefined values will not be added.
   * @param {String} className This class or class list will be added to the SVG element
   * @param {Object} parent The parent SVG wrapper object where this newly created wrapper and it's element will be attached to as child
   * @param {Boolean} insertFirst If this param is set to true in conjunction with a parent element the newly created element will be added as first child element in the parent element
   */
  function Svg(name, attributes, className, parent, insertFirst) {

是否可以告诉Typescript使用JsDoc param类型?如果没有,是否可以像上面那样从JsDoc生成声明文件?我找到了像tsd-jsdoc这样的第三方库,但我对官方的Typescript立场感到好奇。我还在Typescript回购中找到Issue #2916,其中说大部分工作都已涵盖,但我不清楚相关问题的结果是什么。

0 个答案:

没有答案