In a large pan over medium heat, fry diced potatoes in oil or butter until crispy outside and soft inside, about 15-20 minutes. Season with salt and pepper, then add butter and grated onion, frying for another minute. Transfer to a bowl and cool slightly.
Mix in grated cheddar cheese, Dijon mustard, parsley (if using), and heavy cream into the cooled potato mixture. Season with salt and pepper and stir until combined.
Roll out puff pastry if needed and cut into four equal rectangles. Set aside.
Divide filling into four portions, place on one side of each pastry rectangle, brush edges with beaten egg, fold over, and crimp edges with a fork. Cut steam holes on top.
Place pasties on a lined baking tray, brush with egg wash, and bake in a preheated oven at 200C/390F for 15-20 minutes until golden brown and flaky.