Creating a generator method in typescript is simple:
class Foo {
*values() { yield 10 }
}
But I want to create a generator property, something like this:
class Foo {
get *values() { yield 10 }
}
But that seems invalid. It seems I can not find references to this question or workarounds (besides the obvious use of Object.defineProperty it is obvious that it will suck because it will be untyped). Am I missing something? Is it supported? If not, will it be?
source
share