RubenVerborgh / AsyncIterator

An asynchronous iterator library for advanced object pipelines in JavaScript
https://rubenverborgh.github.io/AsyncIterator/docs/
Other
48 stars 7 forks source link

Make @types/node a dependency (rather than devDependency) #70

Open jeswr opened 2 years ago

jeswr commented 2 years ago

If I install the asynciterator package in a new node project, then methods like .on are not shown in my type hints because TypeScript cannot guess the type of EventEmitter which AsyncIterator extends.

@types/node needs to be added as a dependency to resolve this (see https://stackoverflow.com/questions/45176661/how-do-i-decide-whether-types-goes-into-dependencies-or-devdependencies) - otherwise users of the AsyncIterator package need to install @types/node themselves

RubenVerborgh commented 2 years ago

Fine with me, but do we have a TypeScript-authoritative answer? Especially @types/node is tricky, because the actual type will not depend on the package version that we pick, but on the actual Node runtime. Is peer dependency perhaps an option?

rubensworks commented 2 years ago

In Comunica, we also always include types as actual dependencies. For things such as @types/node, we use the version * range, so that the dep will always be available, but downstream users can still choose what version they use.