Challenge: Finding base type of nested optionals

Well here's a challenge that I still haven't found an answer too:
How do you unwrap an arbitrarily nested optional to a single-wrapped optional while preserving the base type?. All the solutions in this post and all the other posts on this topic I've seen either type-erase the result to Any? or don't truly support arbitrarily nested optionals.