Whisk to combine the flour, baking soda, baking powder, and cornstarch in a large bowl; set aside. Beat the butter and both sugars on medium-high speed in the bowl of a stand mixer fitted with a paddle attachment (or in a large bowl if using a handheld mixer) until light and fluffy, about 4 minutes. Add the eggs, one at a time, beating after each addition to incorporate.
Beat in both types of vanilla. Scrape down the side of the bowl as needed. Reduce the speed to medium, add the flour mixture and beat until just incorporated. Finally, stir in the chocolate chips and nuts if using.
Transfer the cookie dough into a medium bowl, cover it tightly, and chill in the refrigerator for at least 30 minutes. If chilling for 3+ hours, make sure you let the cookie dough sit at room temperature for at least 1o to 15 minutes before rolling into balls; the cookie dough will be very stiff after being in the fridge that long.
Form and bake the cookies: Preheat the oven to 350 °F. Position racks in the upper and lower thirds of the oven. Line two baking sheets with parchment paper; set aside. If you only have 1 baking sheet, let it cool completely between batches.
Using a 2-inch ice cream scooper, scoop the dough, scraping each against the bowl as you scoop. Roll each mound in your hands to form a ball.
Place on the prepared baking sheet, about 2 to 3 inches apart. Bake one sheet at a time until the cookies have puffed up and the tops begin to crackle, 10 to 11 minutes; do not overbake.
Remove from the oven and let cool slightly on the baking sheet, then transfer the cookies to a wire rack to cool completely. Repeat forming the remaining dough into balls. Store the walnut chocolate chip cookies in an airtight container.