TypeScript中是否已经支持XML文档?

时间:2012-10-02 08:42:34

标签: xml-documentation typescript

TypeScript中是否已经支持XML文档?似乎没有,但也许我忽视了一些事情。

我想要这样的事情:

export class Point {
   /// <summary>This is a Point class.</summary>

    constructor (public x: number, public y: number) { 
        /// <summary>Creates a new Point object</summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
    }
}

3 个答案:

答案 0 :(得分:5)

在语言规范中没有提到这一点,因此目前不支持此功能。

使用的唯一注释语法是创建对源文件的依赖:

/// <reference path="..."/>

你可以suggest features such as this on the project page - 所以如果这个想法获得牵引力,它将来可以添加到语言中。

答案 1 :(得分:0)

对于它的价值,微软的样本确实包括这种评论风格。来自Parallax样本:

    constructor(scrollableContent: HTMLElement, perspective: number) {
        /// <param name="scrollableContent">The container that will be parallaxed.</param>
        /// <param name="perspective">The ratio of how much back content should be 
        /// scrolled relative to forward content.  For example, if this value is 
        /// 0.5, and there are 2 surfaces, the front-most surface would be scrolled 
        /// normally, and the surface behind it would be scrolled half as much.</param>
        this.perspective = perspective;
        this.surface = [];
        this.content = scrollableContent;

        $(scrollableContent).scroll((event: JQueryEventObject) => {
            this.onContainerScroll(event);
        });
    }

答案 2 :(得分:0)

显然现在支持JSDoc,至少在Visual Studio Code中,因为我现在正在那里使用它,它在intellisense弹出窗口中显示。