Skip to content

Put @types/node as an optional peerDependency #2169

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

Conversation

QuentinLemCode
Copy link
Contributor

Hello

This PR put @types/node as an optional peerDependency.

There was already previous attempt to move it to "devDependency" in order to avoid the size overhead of node types for Javascript project or even production builds.
#1274

However, this would cause issue because the Typescript compiler wouldn't provide correct error types.

In this PR, the @types/node library as been put in devDependencies and in optional peerDependencies.

This allow :

  • To have the node types available when developing on the stripe-node library
  • To provide correct type error for typescript project using stripe-node (assuming project already have @types/node installed)
  • To remove the @types/node dependency for javascript project (reducing size overhead)

@QuentinLemCode QuentinLemCode requested a review from a team as a code owner September 5, 2024 13:49
@QuentinLemCode QuentinLemCode requested review from xavdid-stripe and removed request for a team September 5, 2024 13:49
@QuentinLemCode
Copy link
Contributor Author

This will probably conflict with #2168

@xavdid-stripe
Copy link
Member

Sorry it's been so long since we looked at this! I believe optional peer + dev is the correct path forward, so thank you for suggesting that.

It looks like the CI is failing on latest because the missing undici-types. If you've got time to debug that it would be great, or we can take a look soon(ish)

@QuentinLemCode
Copy link
Contributor Author

Hello @xavdid-stripe
I have fixed the missing package, could relaunch the CI please ?

@QuentinLemCode
Copy link
Contributor Author

@xavdid-stripe Ready to merge :)

Copy link
Member

@xavdid-stripe xavdid-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perfect, thank you!

@xavdid-stripe xavdid-stripe merged commit 06c6299 into stripe:master Apr 24, 2025
9 checks passed
nodoubtz pushed a commit to Dimvy-Clothing-brand/stripe-node that referenced this pull request May 5, 2025
* Put @types/node as optional peerDependency

* add undici types as devDependency

* update tsconfig

---------

Co-authored-by: David Brownman <[email protected]>
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 this pull request may close these issues.

2 participants