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-fetch should be a dependency #67

Open
rdsedmundo opened this issue Oct 8, 2021 · 2 comments
Open

@types/node-fetch should be a dependency #67

rdsedmundo opened this issue Oct 8, 2021 · 2 comments

Comments

@rdsedmundo
Copy link

I'm getting cannot find name Headers because the type definitions of dwolla-v2 are referencing this interface as if it were available globally.

Another option is upgrading node-fetch to v3 as it includes the TS definitions built-in.

@pting-me
Copy link
Contributor

pting-me commented Feb 13, 2022

Seems strange that Response is defined but Headers is not.

In addition to either of the suggested fixes, we should remove the custom interface for Response altogether. That should be coming from node-fetch.

Edit: Just realized handleResponse in Token.js is creating a custom response object. I'd advocate for renaming Response to something like ParsedResponse to avoid confusion with the Response type that will be coming from node-fetch.

@rdsedmundo
Copy link
Author

This is no longer an issue in Node.js 18 as this interface is actually available in the global namespace, as part of the native fetch support. I'll leave up to you whether or not you should support older versions of Node.js and thus keep the issue open.

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

2 participants