8

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>
    }
}
4

3 に答える 3

5

言語仕様にはこれについての言及がないため、現在、この機能はサポートされていません。

使用されている唯一のコメント構文は、ソース ファイルへの依存関係を作成することです。

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

プロジェクト ページでこのような機能を提案することができます。そのため、アイデアが注目を集めた場合、将来的に言語に追加される可能性があります。

于 2012-10-02T08:53:42.293 に答える
1

どうやら JSDoc は、少なくとも Visual Studio Code でサポートされているようです。現在使用していて、インテリセンス ポップアップに表示されます。

于 2016-12-28T11:58:15.657 に答える
0

価値があるのは、Microsoft のサンプルにこのスタイルのコメントが含まれていることです。視差サンプルから:

    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);
        });
    }
于 2012-10-06T04:49:42.167 に答える