angulartypescripttsconfigtsconfig.json

how I can disable some ngtsc warnings


After I upgraded my Angular application to v15, some warnings started showing in terminal and chrome devtool Is there any way soI can disable those warnings.

The left side of this optional chain operation does not include 'null' or 'undefined' in its type, therefore the '?.' operator can be replaced with the '.' 
operator.ngtsc(-998107)

Solution

  • You can disable it by adding additional config in tsconfig.json:

    "angularCompilerOptions": {
        "extendedDiagnostics": {
          "checks": {
            "optionalChainNotNullable": "suppress"
          }
        }
      }
    

    Or

    You can disable it with installing tsc-silent, a package that overrides tsconfig.json and adds additional settings. Do following:

    1. npm install -g tsc-silent
    2. tsc-silent -p tsconfig.json --suppress 8107@src/js/
    

    Check the documentation for more information: https://github.com/evolution-gaming/tsc-silent