const a = ['a', 'b'] as const;
SonarQube reports this Typescript as unnecessary cast. “as const” is a special case of “as” and should not error in this context.
Hello Guy,
Welcome back to the SonarSource community forum!
I am not able to reproduce the false-positive with the latest version of SonarQube. You mentionned using SonarQube 1.34.2, but that version doesn’t exist.
Please clarify your SonarQube setup including the analysis properties.
Regards, Yassin