This site uses cookies for analytics. By continuing to browse this site, you agree to this use.
A JS Foundation Project

TypeScript remove comments

TypeScript remove comments (no-comments)

typescript-config/no-comments checks that the property removeComments is enabled in your TypeScript configuration file (i.e. tsconfig.json).

Why is this important?

Removing the comments will make your final JavaScript files smaller. If you are delivering these files over the Internet, you want them to be a small as possible.

What does the hint check?

This hint checks if the compilerOptions property removeComments is enabled.

Examples that trigger the hint

By default, TypeScript doesn’t strip the comments:

{
    ...
    "compilerOptions": {
        "target": "es5",
    },
    ...
}

Also setting the value to false will fail:

{
    ...
    "compilerOptions": {
        "removeComments": false,
        ...
    },
    ...
}

Examples that pass the hint

removeComments value is true:

{
    "compilerOptions": {
        "removeComments": true,
        ...
    },
    ...
}

Further Reading