The next
method exists on the generator that the function returns, not on the generator function itself.
export default class GeneratorClass {
constructor() {
const iterator = this.generator(10);
iterator.next();
}
*generator(count:number): IterableIterator<number> {
while(true)
yield count++;
}
}