Which rule? Union types should not have too many elements S4622
Why do you believe it’s a false-positive/false-negative?
I believe this is a false positive because I am not doing a union of types, I am Pick keys to building a type
Are you using
SonarQube - 9.5
How can we reproduce the problem? Give us a self-contained snippet of code
Welcome and thank you for your feedback.
This issue appears here because Pick<Type, Keys> accepts a union of string literals for Keys, and S4622 targets a union with more than 3 types by default.
You can still avoid the issue by defining a new type for the union of the keys and using it in Pick.
You can also configure the rule to allow more elements than the default value of 3 if you feel it’s too low.