String Enums

👨‍💼 We're building an order management system. Orders go through different statuses, and we want type-safe status values.
enum OrderStatus {
	Pending = 'pending',
	Processing = 'processing',
	Shipped = 'shipped',
	Delivered = 'delivered',
}
🐨 Open and:
  1. Create an OrderStatus enum with the statuses above
  2. Create an order object that uses the enum
  3. Create a function that handles each status
💰 Using enum values:
const status = OrderStatus.Pending
if (status === OrderStatus.Shipped) {
	// ...
}
If you see an "experimental transform-types" warning when running this step, that's from the workshop runtime and can be ignored.

Please set the playground first

Loading "String Enums"
Loading "String Enums"
Login to get access to the exclusive discord channel.