Where is the syntax for TypeScript comments documented?

前端 未结 5 809
执念已碎
执念已碎 2020-12-04 11:30

Is the syntax for TypeScript comments documented anywhere?

And by any chance, does it now support the C# /// system?

5条回答
  •  猫巷女王i
    2020-12-04 12:08

    You can use comments like in regular JavaScript:

    1 Introduction

    [...] TypeScript syntax is a superset of ECMAScript 2015 (ES2015) syntax.

    2 Basic Concepts

    [...] This document describes the syntactic grammar added by TypeScript [...]

    Source: TypeScript Language Specification


    The only two mentions of the word "comments" in the spec are:

    1 Introduction

    [...] TypeScript also provides to JavaScript programmers a system of optional type annotations. These type annotations are like the JSDoc comments found in the Closure system, but in TypeScript they are integrated directly into the language syntax. This integration makes the code more readable and reduces the maintenance cost of synchronizing type annotations with their corresponding variables.

    11.1.1 Source Files Dependencies

    [...] A comment of the form /// adds a dependency on the source file specified in the path argument. The path is resolved relative to the directory of the containing source file.

提交回复
热议问题