// Type definitions for co 4.6 // Project: https://github.com/tj/co#readme // Definitions by: Doniyor Aliyev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Minimum TypeScript Version: 3.6 // Since TS 3.6 the checker knows that the correct type of returned values and yielded values https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-6.html // Generator => TReturn // Function => ReturnType // others => others type ExtractType = I extends { [Symbol.iterator]: () => Iterator } ? TReturn : I extends (...args: any[]) => any ? ReturnType : I; interface Co { Iterator>(fn: F, ...args: Parameters): Promise< ExtractType> >; default: Co; co: Co; wrap: Iterator>( fn: F, ) => (...args: Parameters) => Promise>>; } declare const co: Co; export = co;