Preheat the oven to 350°F (175°C) and grease a 6-cavity donut pan well.
Whisk together the flour, brown sugar, baking powder, cinnamon, nutmeg, and salt in a medium bowl.
Press the crushed pineapple through a fine mesh sieve, reserving the drained liquid for the glaze.
In a separate bowl, whisk the egg, melted butter, milk, and vanilla, then whisk in the mashed sweet potato until smooth.
Pour the wet ingredients into the dry ingredients and fold until just combined. Fold in the pressed pineapple last.
Spoon or pipe the batter into the donut cavities, filling each about two-thirds full.
Bake for 14–16 minutes, until the edges are golden and a toothpick comes out clean.
Cool in the pan for 5 minutes, then turn out onto a wire rack to cool completely.
Whisk the powdered sugar, reserved pineapple juice, and a pinch of salt into a smooth glaze.
Dip the top of each cooled donut into the glaze and top with toasted coconut, if using.