mirror of
https://github.com/labs42io/clean-code-typescript.git
synced 2025-04-17 14:43:36 +00:00
Fix addItemToCart example to return CartItem array instead of object
This commit is contained in:
parent
4c6d10ce64
commit
f5d8cb566a
1 changed files with 1 additions and 1 deletions
|
@ -685,7 +685,7 @@ function addItemToCart(cart: CartItem[], item:Item):void {
|
|||
|
||||
```ts
|
||||
function addItemToCart(cart: CartItem[], item:Item):CartItem[] {
|
||||
return {...cart, { item, date: Date.now() }};
|
||||
return [...cart, { item, date: Date.now() }];
|
||||
};
|
||||
```
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue