Code Review for a sales tax problem solved using Elixir

Thank you @david_ex :slight_smile: , I’ve attempted to fix the typespecs in this PR. It would be great if you could review that PR and share your thoughts.

I’m currently still getting 2 more errors with regard to the type specs in shopping_cart.ex which I’m finding it difficult to debug. I’m getting the below errors with regard to that file when running the updated type specs with the dialyzer package. Those errors are:

lib/sales_tax.ex:54:no_return
The created fun has no local return.


lib/sales_tax.ex:56:call
The call:
ShoppingCart.initialize_cart_product(_total_sales_tax_from_one_item :: float(), _product :: Item)

breaks the contract
(number(), input_item()) :: output_item()


Any ideas on what I could be doing wrong here?

Also it feels like there isn’t much detailed documentation how to use typespecs with custom types. Any suggestions on where I could learn more on the best practices to adhere to when using typespecs with custom types would be really helpful. Thank you!