Improving Pizza Order exercise

Hi community :wave:

Context:
Exercise : Pizza order

At the moment, the orderPrice(pizzaOrders) function to implement isn’t really clear because we have no idea about what is PizzaOrder pass in parameters.

@param {PizzaOrder[]} pizzaOrders a list of pizza orders

Proposal:

  • We could help the developper to provide more information inside js docs :
* @typedef PizzaOrder
* @type {object}
* @property {string} pizza - the name of the pizza.
* @property {string[]} extras - the name of extras ingredients of the pizza.
@param {PizzaOrder[]} pizzaOrders a list of pizza orders
  • Precise the PizzaOrder inside the instruction of the task’s exercise

What do you think about that ? :face_with_monocle:

Expected:
Give more information about the developper of what is PizzaOrder

I agree. I had to look at the test to see how it was defined.

I was also initially confused about the JSDoc string for the first function. Pizza and Extras are not defined anywhere. These should have just been strings:

/**

  • Determine the prize of the pizza given the pizza and optional extras
  • @param {string} pizza name of the pizza to be made
  • @param {string[]} extras list of extras
  • @returns {number} the price of the pizza

*/

export function pizzaPrice(pizza, …extras) {

They should not have been strings, because what can be passed in is clearly defined here.

I think what we can do best is expose global.d.ts for this exercise to the user as read-only file. This can be accomplished by updating config.json for that exercise and adding the editor key as described in the contribution docs.

We’ll take a PR.

1 Like

It could be a great improvement :+1:

Thanks for that :pray:

I could make a PR, if nobody is already on it?

EDIT: something like this?

1 Like

Merged!

Thank you.

1 Like