How can I access class members during the creation of an anonymous object?
class foo {
private working = 'hello';
private notWorking = 'world';
public method() {
new DoSomethingClass(working, {
...,
this.notWorking //this throws an error as this has a different scope now
});
}
}
thisin another variable before the scope change? E.g.const self = this;right before you donew DoSomethingClassand then useselfwithin the new scope. It may still not be possible to access a private property that way though.:are not valid there.DoSomethingClass? I am confused as to why you want to add the logic inside thefooclass and not theDoSomethingClass.{theKeyTheLibWants: this.notWorking}