False positive: S4782 Optional undefined property

Rule S4782 currently does not allow

interface noFoo {
  foo?: undefined;

(meaning noFoo has no foo key, or if it has, it’s value is undefined, useful for typeguards, or in a union of either-or interfaces)

Sonar reports an issue, to remove the optional operator (which can not be removed, as it is optional), or remove undefined (which would cause a compiler-exception).

Expected behavior

Accept optional undefined if undefined is the exact type (e.g. not foo?: string | undefined , but foo?: undefined ).

Hey there.

We’re missing what product you’re using – SonarCloud, SonarQube or SonarLint (and if one of the latter two, which version?)