01 - Set oven temperature to 400°F.
02 - Boil a large pot of salted water. Add potatoes and cook until fork-tender, about 15 minutes. Drain thoroughly.
03 - Mash the drained potatoes with milk and butter. Season with salt and pepper. Fold in grated cheddar cheese if using. Set aside.
04 - Heat olive oil in a large skillet over medium heat. Sauté onion and garlic until softened, approximately 3 minutes.
05 - Add diced carrots to the skillet and cook for 4 to 5 minutes, stirring frequently.
06 - Add ground beef and cook, breaking up with a spoon, until no pink remains, about 6 to 8 minutes. Drain excess fat if needed.
07 - Incorporate tomato paste, Worcestershire sauce, dried thyme, dried rosemary, salt, and pepper. Cook for 2 minutes to develop flavors.
08 - Sprinkle flour over the beef mixture and stir thoroughly to coat. Add beef broth and bring to a simmer.
09 - Stir in frozen peas and simmer for 3 to 4 minutes until slightly thickened. Adjust seasoning as necessary.
10 - Transfer the beef filling into a 2-quart baking dish.
11 - Evenly spread the mashed potatoes atop the filling. Use a fork to create ridges for browning.
12 - Bake for 25 to 30 minutes until the topping is golden and the filling is bubbling.
13 - Allow the dish to rest for 10 minutes to set before serving.