My typescript code looks like
class BaseExample {
protected _foo: string = ''
foo(foo: string) {
this._foo = foo
}
bar() {
return this._foo
}
}
class Example extends BaseExample {
bar() {
return this._foo + this._foo
}
}
const example = new Example()
example.foo('foo')
console.log(example.bar())
and output javascript code is
class {
_foo = "";
foo(r) {
this._foo = r
}
bar() {
return this._foo
}
}
The problem is that I can not find a solution in which all protected methods and variables will be hidden from the user.
Perhaps there is some plugin that translates the protected syntax into weakmap or Symbol or something like that?