Heat the oven to 350°F (175°C). Line an 8-inch square baking pan with parchment, leaving overhang on two sides.
Melt the butter in a medium saucepan over low heat. Remove from the heat and whisk in the granulated sugar, brown sugar, cocoa powder, and salt until smooth. Let the mixture cool for 2 to 3 minutes.
Whisk in the eggs one at a time, mixing well after each addition until the batter looks glossy. Stir in the vanilla.
Fold in the flour just until no dry streaks remain. Fold in the chopped chocolate or chips, if using. Avoid overmixing.
Spread the batter evenly in the prepared pan. Bake for 28 to 32 minutes, until the edges are set and a toothpick in the center comes out with moist crumbs, not wet batter.
Set the pan on a rack and cool completely, about 1 hour, before lifting out and cutting into 16 squares.