A readonly field is an identifier that should not change. An optional number is either a number or missing. When you update an object, return a new object instead of changing the old one. This helps avoid surprises.
interface Item {
readonly code: string;
qty?: number;
}You will raise the stock count and keep other fields the same.
Increase stock without changing the original item.
interface Item { readonly sku: string; name: string; stock?: number }.restock(item: Item, amount: number): Item that returns a new object with stock increased by amount (use 0 when stock is missing).sku unchanged.