Scanner using rules for a newer version of typescript

We’re using SonarCloud to scan a project that’s using an older version of typescript, (v3.2.1) and in the last week we’ve started getting a lot of issues being found asking us to use features that aren’t supported in this version. For example, typescript:S6582 “Optional chaining should be preferred” refers to a feature added in typescript v3.7.

I had assumed that the scanner only applies rules that are applicable to the version of the language you are using. Is this not the case? How should we deal with this issue, as upgrading the typescript version is not practical in the short term?

Template for a good new topic, formatted with Markdown:

  • ALM used: Azure DevOps
  • CI system used: Azure DevOps
  • Typescript (v3.2.1)

Hi Martin,

Thank you for bringing up this issue. In the short term, I suggest that you disable this rule in your quality profile (or exclude the rule for all files: Narrowing the focus with analysis scope).
The TypeScript analyzer does not detect the TypeScript version you are using in your project. We assume that developers are using recent versions of TypeScript.