Search code examples
typescripttsc

TypeScript compile and keep comments


I like to have my comments intact in the resulting javascript file, by default the compiler removes them. Is there a tsc parameter for that? (The use case is to keep /// reference path's = ... for chutzpah unit testing. )


Solution

  • Yes, the -c (or --comments) option;

    Syntax: tsc [options] [file ..]

    Examples: tsc hello.ts
    tsc --out foo.js foo.ts
    tsc @args.txt

    Options:
       -c, --comments        Emit comments to output
    ...