Avatar ·

How to create an enum with string values in TypeScript?

Hi! I just started learning TypeScript and ran into a problem while working with enums. I need to create an enum that stores string values for order statuses in an online store: "pending", "shipped", "delivered", and "cancelled". I tried writing this code: ```typescript enum OrderStatus { Pending = "pending", Shipped = "shipped", Delivered = "delivered", Cancelled = "cancelled" } ``` It seems to work, but I'm not sure if it's correct. When I try to use this enum in a function: ```typescript function updateOrderStatus(status: OrderStatus) { console.log(`Order status changed to: ${status}`); } updateOrderStatus("shipped"); // Error! ``` TypeScript throws an error: `Ar