馃攷 Search Terms
An error TS1111 is raised when (properly) using a private generator function. I'm using VSCode, and it will report Private field '#iterate' must be declared in an enclosing class. when calling child.#iterate().
馃晽 Version & Regression Information
- I'm hitting this in VSCode 1.135.0
馃捇 Code
class Foo {
*iterate() {
yield* this.#iterate()
}
*#iterate() {
const child = this.child
if (child instanceof this.constructor) {
yield* child.#iterate()
}
}
}
let f = new Foo()
for (const i of f.iterate()) {
}
馃檨 Actual behavior
An error TS1111 is raised.
馃檪 Expected behavior
There should be no error.
Additional information about the issue
- The error disappears if I call
this.#iterate(), but of course that's not the point.
- I can also clear the error by adding
assert(#iterate in child) before the call
馃攷 Search Terms
An error TS1111 is raised when (properly) using a private generator function. I'm using VSCode, and it will report
Private field '#iterate' must be declared in an enclosing class.when callingchild.#iterate().馃晽 Version & Regression Information
馃捇 Code
馃檨 Actual behavior
An error TS1111 is raised.
馃檪 Expected behavior
There should be no error.
Additional information about the issue
this.#iterate(), but of course that's not the point.assert(#iterate in child)before the call