EasyPost / easypost-node

EasyPost Shipping API Client Library for Node
https://easypost.com/docs/api
MIT License
139 stars 54 forks source link

Fix incorrect types #438

Open bensontrent opened 8 months ago

bensontrent commented 8 months ago

I made zip optional in IAddressCreateParameters since a zip code is not required in many countries. Also added optional service and tax_identifiers to IShipmentCreateParameteres to enable one-call buys.

bensontrent commented 8 months ago

You can close this pull release, I'm just offering it as a suggestion.

Both zip and country are optional in IAddressCreateParameters according to the actual way the API works: the API will correctly return an error but the API does technically accept a blank value. The reason a zip ought to be optional: consider a new user-facing address form, all of those values would initially be blank. If my form object has a typescript type of IAddressCreateParameters, I'd have errors in my code since a zip code would initially be blank. Also we, know a street1 and a name are required to create a shipment, but having those values as optional seem to be correct way to handle the creation of a form object while the form is in the process of being filled out.

The changes I submitted were necessary for my typescript to validate, so I'll just use my own fork of the project to facilitate the needs of my project.

Thanks for looking at this!