Preheat the oven to 350°F (175°C) and lightly grease a 9x13-inch baking dish with butter or nonstick spray.
Place the cubed sweet potatoes in a large pot and cover with cold water. Bring to a boil over high heat, then reduce to a steady simmer and cook for 12 to 15 minutes, until the potatoes are fork-tender. Drain well and let them sit in the colander for a couple of minutes so the excess steam escapes.
Transfer the warm sweet potatoes to a large mixing bowl. Add the melted butter, brown sugar, milk, eggs, vanilla, cinnamon, nutmeg, and salt. Mash with a potato masher or beat with a hand mixer until smooth and creamy, leaving a few small lumps if you prefer a little texture.
Spread the sweet potato mixture evenly into the prepared baking dish, smoothing the top with the back of a spoon.
In a medium bowl, stir together the chopped pecans, brown sugar, flour, cinnamon, and salt. Pour in the melted butter and mix until the topping looks like moist, crumbly sand.
Sprinkle the pecan topping evenly over the sweet potatoes, covering the surface all the way to the edges.
Bake uncovered for 30 to 35 minutes, until the filling is set, the edges are bubbling, and the topping is deep golden brown. Let the casserole rest for 10 minutes before serving so it firms up slightly and is easier to scoop.