interface QuansyncOptions { onYield?: (value: any, isAsync: boolean) => any; } interface QuansyncInputObject extends QuansyncOptions { name?: string; sync: (...args: Args) => Return; async: (...args: Args) => Promise; } type QuansyncGeneratorFn = ((...args: Args) => QuansyncGenerator); type QuansyncInput = QuansyncInputObject | QuansyncGeneratorFn; type QuansyncGenerator = Generator> & { __quansync?: true; }; type QuansyncAwaitableGenerator = QuansyncGenerator & PromiseLike; /** * "Superposition" function that can be consumed in both sync and async contexts. */ type QuansyncFn = ((...args: Args) => QuansyncAwaitableGenerator) & { /** * **Warning**: The `async` and `sync` methods will be lost after invoked. */ bind: (this: (this: T, ...args: [...A, ...B]) => QuansyncAwaitableGenerator, thisArg: T, ...args: A) => ((...args: B) => QuansyncAwaitableGenerator); sync: (...args: Args) => Return; async: (...args: Args) => Promise; }; export type { QuansyncAwaitableGenerator, QuansyncFn, QuansyncGenerator, QuansyncGeneratorFn, QuansyncInput, QuansyncInputObject, QuansyncOptions };