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

@types/node in direct dependencies #1274

Closed
berhalak opened this issue Oct 18, 2021 · 3 comments
Closed

@types/node in direct dependencies #1274

berhalak opened this issue Oct 18, 2021 · 3 comments
Assignees

Comments

@berhalak
Copy link

Hi,
Is there any reason why package @types/node is included as a direct dependency and not as a devDependencies in package.json?

@richardm-stripe richardm-stripe self-assigned this Oct 18, 2021
@richardm-stripe
Copy link
Contributor

Hello @berhalak, thanks for the inquiry.

I can't see a reason. I will investigate briefly and likely move it in #1275, per your suggestion.

@richardm-stripe
Copy link
Contributor

@berhalak, with some research, I found when the dependency was added. I do think it does belong in dependencies. @types/node isn't needed just for the maintainers/CI, it is needed by any users of the stripe-node typescript types, since the types types in stripe-node won't properly resolve without @types/node, and the devDependencies of a module don't get installed into projects that depend on it.

For a concrete example of why @types/node needs to be in dependencies, I created a small test project that shouldn't compile with Typescript:

$ npm init
$ npm install stripe
$ npm install typescript
$ node_modules/.bin/tsc --init
// index.ts
import Stripe from "stripe";

const stripe = new Stripe("sk_test_xyz", {
  apiVersion: "2020-08-27",
  httpAgent: "foo", // This should report a type error
});
$ node_modules/.bin/tsc index.ts

This will produce the correct type error only if @types/node is registered as a true dependency, not a dev dependency.

@richardm-stripe
Copy link
Contributor

Anyway I think I'm going to close this out as we are not going to take any action, but I wanted to ask: does the presence of @types/node in dependencies cause a problem for you?

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

Successfully merging a pull request may close this issue.

2 participants