The function* declaration (function keyword followed by an asterisk) defines a generator function, which returns a Generator object. [Reference]
But if I do:
const genFn: GeneratorFunction = function* () {};
I get:
Property '[Symbol.toStringTag]' is missing in type '() => Generator<never, void, unknown>' but required in type 'GeneratorFunction'.ts(2741)
lib.es2015.symbol.wellknown.d.ts(161, 14): '[Symbol.toStringTag]' is declared here.
What does the GeneratorFunction interface stands for in TypeScript? Also, is there a more appropriate built-in interface for me to capture generator functions?