# Challenge: Finding base type of nested optionals

**URL:** <https://forums.swift.org/t/challenge-finding-base-type-of-nested-optionals/25096>\
**Category:** Using Swift\
**Created:** [June 1, 2019, 8:43am UTC](https://forums.swift.org/t/challenge-finding-base-type-of-nested-optionals/25096 "2019-06-01T08:43:41Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![Peter-Schorn](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/peter-schorn/32/11183_2.png) [@Peter-Schorn](https://forums.swift.org/u/Peter-Schorn)\
**Post date:** [July 2, 2020, 5:09am UTC](https://forums.swift.org/t/challenge-finding-base-type-of-nested-optionals/25096/15 "2020-07-02T05:09:04Z")

</div>

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](https://forums.swift.org/t/challenge-flattening-nested-optionals/24083) 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.

---

_[View the full topic](https://forums.swift.org/t/challenge-finding-base-type-of-nested-optionals/25096)._
