01 - Preheat oven to 400°F. Line a large baking sheet with parchment paper.
02 - In a large bowl, combine sweet potatoes and apples.
03 - In a separate small bowl, whisk together maple syrup, melted butter, cinnamon, nutmeg, salt, and pepper until smooth.
04 - Pour the glaze over the sweet potatoes and apples. Toss until all pieces are evenly coated.
05 - Spread the mixture in a single layer on the prepared baking sheet, ensuring pieces aren't overcrowded.
06 - Roast for 35–40 minutes, stirring halfway through cooking time, until sweet potatoes are fork-tender and edges are caramelized.
07 - If using pecans or walnuts, sprinkle them over the dish during the last 5 minutes of roasting for a light toast.
08 - Transfer to a serving dish, garnish with fresh thyme if desired, and serve warm.