Private named instance fields by mheiber · Pull Request #30829 · microsoft/TypeScript (original) (raw)
Forgive me if this is obvious, but I've look around on the issues and couldn't see this covered anywhere:
Is there any particular reason why we can't do private #bar = 3;
?
(In case its not clear, I mean this purely as a meaningless sugar that would never make it into compiled code)
Would there be any chance of getting that syntax supported?
In my eyes it'd give us the best of both worlds, as then all class properties can maintain their indentation level, along with making refactoring easy for people like me who prefix all our private properties with _
.
I mean you could pretty much just use a global find-and-replace using /private #/
regex, since #
is only valid for private class properties - the only issue with this I can think of would be with strings.
Also, could someone confirm for me if its planned for TS somewhere down the line to transform private
to #
? (I suspect it is, but again there's a lot of heavy comments, PRs, & issues on the matter, so it'd be nice to have a simple one-liner comment about it if possible).