easypost-node icon indicating copy to clipboard operation
easypost-node copied to clipboard

Fix incorrect types

Open bensontrent opened this issue 5 months ago • 1 comments

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 avatar Mar 16 '24 20:03 bensontrent

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!

bensontrent avatar Mar 18 '24 15:03 bensontrent