mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
19 lines
642 B
TypeScript
19 lines
642 B
TypeScript
// Type definitions for co 4.6
|
|
// Project: https://github.com/tj/co#readme
|
|
// Definitions by: Doniyor Aliyev <https://github.com/doniyor2109>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
// TypeScript Version: 3.1
|
|
|
|
type ExtractType<T> = T extends IterableIterator<infer R> ? R : never;
|
|
|
|
interface Co {
|
|
<F extends (...args: any[]) => Iterator<any>>(fn: F, ...args: Parameters<F>): Promise<ExtractType<ReturnType<F>>>;
|
|
default: Co;
|
|
co: Co;
|
|
wrap: <F extends (...args: any[]) => Iterator<any>>(fn: F) => (...args: Parameters<F>) => Promise<ExtractType<ReturnType<F>>>;
|
|
}
|
|
|
|
declare const co: Co;
|
|
|
|
export = co;
|