Preheat your oven to 375°F (190°C). If you’re using a baking dish, give it a light spray with nonstick spray or a quick wipe of butter.
Boil or steam the cubed sweet potatoes until they’re very tender, about 12 to 15 minutes. You should be able to pierce them easily with a fork.
Drain them well, then return to the pot. Add butter, milk, maple syrup, vanilla, and salt. Mash until smooth and creamy. If you like a bit more texture, you can leave a few small lumps—your call.
Stir in the cinnamon and, if you’re using it, a pinch of nutmeg or allspice. Taste and adjust a tad more maple or salt if needed.
Spread the mashed sweet potatoes into a shallow baking dish. Sprinkle the chopped walnuts evenly on top.
Bake for about 15 minutes, until the walnuts are lightly toasted and the casserole is heated through. If you’d like extra browning, switch to broil for 1–2 minutes, watching carefully so they don’t burn.
Let it rest for a few minutes before serving. The flavors settle nicely as it cools a touch.