braintree / braintree_node

Braintree Node.js library
https://developer.paypal.com/braintree/docs/start/overview
MIT License
334 stars 104 forks source link

Incorrect type on errors field in Braintree ValidatedResponse #213

Closed RowanG1Bilue closed 1 year ago

RowanG1Bilue commented 1 year ago

For the interface of Braintree below:

 interface ValidatedResponse<T> {
        success: boolean;
        errors: ValidationErrorsCollection;
...
}

When we get a success is true response, the errors field is undefined, whereas in the type declaration, the errors field has to be defined. This can potentially cause unexpected errors to be thrown, if a developer happens to access the errors on the success path (which generally should not happen in principle).

General information

Issue description

hollabaq86 commented 1 year ago

👋 @RowanG1Bilue thanks for reaching out. This SDK doesn't have type support yet 🙃 I think the root of your issue is in a different library that uses Braintree Node?

crookedneighbor commented 1 year ago

More than likely, the problem is in the Definitely Typed repo: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/braintree

Closed as a duplicate of #176