Preheat your oven to 350°F (175°C) and grease a 9x9-inch baking pan or line it with parchment paper.
In a large mixing bowl, combine the mashed sweet potatoes and melted butter, stirring until smooth.
Add the brown sugar and granulated sugar, mixing well.
Beat in the eggs one at a time, followed by the vanilla extract.
In a separate bowl, whisk together the flour, baking powder, baking soda, and salt.
Gradually add the dry ingredients to the wet mixture, stirring until just combined.
Fold in the salted caramel sauce and chopped pecans if using.
Pour the batter into the prepared baking pan and spread it evenly.
Bake for 25-30 minutes, or until a toothpick inserted in the center comes out clean.
Remove from the oven and let cool for at least 10 minutes.
Drizzle additional salted caramel sauce on top and sprinkle with flaky sea salt before cutting into squares.