gulpjs / async-done

Allows libraries to handle various caller provided asynchronous functions uniformly. Maps promises, observables, child processes and streams, and callbacks to callback style.
MIT License
69 stars 21 forks source link

Type definition file is missing explicit dependency on @types/node #49

Closed Elephant-Vessel closed 5 years ago

Elephant-Vessel commented 5 years ago

This ...

import { ChildProcess } from "child_process";
import { EventEmitter } from "events";
import { Stream } from "stream";

... errors in the log when I'm building my typescript project as these modules are not defined, as I've had no need for the types of node. When I manually added @types/node to my project, I could build without the index.d.ts of async-done writing errors in the log.

demurgos commented 5 years ago

The project is avoiding to define global environment types. It's up to the user to provide them (similarly to the JS lib or DOM definitions). Types from @types are a special case since they're from the DT mono-repo which enforces a single @types/node version across all its packages. Defining an explicit dependency on a given version of @types/node may cause issues for users using a different major version of Node (due to the global nature of these types). We could explore adding @types/node with a * range, but I am not sure if it is worth it.

Add @types/node to your dev-dependencies if you wish to use this lib in Node.

demurgos commented 5 years ago

See https://github.com/Microsoft/types-publisher/issues/81#issuecomment-459314973