Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jeswr opened this issue Jun 1, 2022 · 2 comments
Open

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

jeswr opened this issue Jun 1, 2022 · 2 comments

Comments

@jeswr
Copy link
Collaborator

jeswr commented Jun 1, 2022

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
Copy link
Owner

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
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants