SonarCloud not picking up Typescript files

  • ALM used: GitHub
  • CI system used: GitHub
  • Languages of the repository: TS, JS
  • Only if the SonarCloud project is public: GitHub - dod-ccpo/atat-web-api: ATAT Web API. An internal API.
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
    An ID from a previously failing scan: AXw30amFsmRyimx49Zxt

TypeScript files are not being picked up by the scanner using the default configuration. The same config is working on another repo.

1 Like

Hi @jeffsegal-ccpo welcome to the community.

The only error i see is the :

ERROR: Unknown compiler option 'useUnknownInCatchVariables'.

Can you check on your side what is going wrong here ? I’m not sure but it might be the case we skip the rest of the file if there are errors while parsing the tsconfig.


I believe this is where the issue originates from Support TypeScript 4.4 · Issue #2802 · SonarSource/SonarJS · GitHub

Essentially the issue comes up after updating to the latest typescript version.

You can still keep the latest ts version (4.4.3 currently) and the scanner will correctly identify lines of code if you comment out the useUnknownInCatchVariables and exactOptionalPropertyTypes options in tsconfig if that works out for you, but it is obviously just a short term solution.

Also find this relevant topic TypeScript: useUnknownInCatchVariables compiler option causes main branch to show up empty

1 Like

I just noticed that the 4.4 option exactOptionalPropertyTypes still isn’t supported yet in our SonarQube Enterprise Edition Version 8.9.7 (build 52159).
It errors out with ERROR: Unknown compiler option 'exactOptionalPropertyTypes'. while parsing the tsconfig.json.
Could this be added, too?
Cheers, Steffen