dwolla-v2-node
dwolla-v2-node copied to clipboard
@types/node-fetch should be a dependency
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.
~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
.
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.