Shouldn't be this a compiler error...

Hi,
two weeks ago I have done some refactoring, basically changing some setters/getters into functions. Coming from .net world, I was expecting that I will get compiler errors, but there was none. Here is an example:

That said, one thing we could do, or a rule that linting tools could add, would be to warn on expressions that don't appear to have an effect. This would only be a best effort, as I believe that if you use a getter as a standalone statement, it could still
have side effects .

Yes, it’s completely valid statement and also getters used standalone can still have effect on program execution. But in C# even getters(get properties) can’t be used standalone, you get compiler error. It’s also very confusing because if used standalone,
it can be getter or setter, OK it's getter but very confusing.

So I hope that this kind of lint tools will make the way to type script compiler and rise the confidence. I daily switch different development environment and only in ts I find myself producing intentional errors to see compiler reaction. You can generate warning
for the issues that don’t prevent js generation and developers can then switch on/off particular warning. And of course by default all warnings should be switched on.

For the standalone statement for preventing warning you could also parenthesis, like this:

var a = 3;
a; // warning XXXX; you can disable it
(a); // no warning even if warning XXXX is enabled.