@types/co
TypeScript definitions for co
Last updated 5 years ago by types .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install @types/co 
SYNC missed versions from official npm registry.

Installation

npm install --save @types/co

Summary

This package contains type definitions for co (https://github.com/tj/co#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/co.

index.d.ts

// 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
// 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<T, TReturn, TNext> => TReturn
// Function => ReturnType<Function>
// others => others
type ExtractType<I> = I extends { [Symbol.iterator]: () => Iterator<any, infer TReturn, any> }
    ? TReturn
    : I extends (...args: any[]) => any
    ? ReturnType<I>
    : I;

interface Co {
    <F extends (...args: any[]) => Iterator<any, any, any>>(fn: F, ...args: Parameters<F>): Promise<
        ExtractType<ReturnType<F>>
    >;
    default: Co;
    co: Co;
    wrap: <F extends (...args: any[]) => Iterator<any, any, any>>(
        fn: F,
    ) => (...args: Parameters<F>) => Promise<ExtractType<ReturnType<F>>>;
}

declare const co: Co;

export = co;

Additional Details

  • Last updated: Mon, 27 Sep 2021 14:01:21 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by Doniyor Aliyev.

Current Tags

  • 4.6.3                                ...           latest (5 years ago)
  • 4.6.2                                ...           ts3.1 (7 years ago)
  • 4.6.2                                ...           ts3.2 (7 years ago)
  • 4.6.2                                ...           ts3.3 (7 years ago)
  • 4.6.2                                ...           ts3.4 (7 years ago)
  • 4.6.2                                ...           ts3.5 (7 years ago)
  • 4.6.2                                ...           ts3.6 (7 years ago)
  • 4.6.3                                ...           ts3.7 (5 years ago)
  • 4.6.3                                ...           ts3.8 (5 years ago)
  • 4.6.3                                ...           ts3.9 (5 years ago)
  • 4.6.3                                ...           ts4.0 (5 years ago)
  • 4.6.3                                ...           ts4.1 (5 years ago)
  • 4.6.3                                ...           ts4.2 (5 years ago)
  • 4.6.3                                ...           ts4.3 (5 years ago)
  • 4.6.3                                ...           ts4.4 (5 years ago)
  • 4.6.3                                ...           ts4.5 (5 years ago)
  • 4.6.3                                ...           ts4.6 (5 years ago)
  • 4.6.3                                ...           ts4.7 (5 years ago)
  • 4.6.3                                ...           ts4.8 (5 years ago)
  • 4.6.3                                ...           ts4.9 (5 years ago)
  • 4.6.3                                ...           ts5.0 (5 years ago)
  • 4.6.3                                ...           ts5.1 (5 years ago)

4 Versions

  • 4.6.3                                ...           5 years ago
  • 4.6.2                                ...           7 years ago
  • 4.6.1                                ...           7 years ago
  • 4.6.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org | Home |