# Transitive export of inner type via public typealias warning

**URL:** <https://forums.swift.org/t/transitive-export-of-inner-type-via-public-typealias-warning/65631>\
**Category:** Compiler\
**Tags:** typealias, import\
**Created:** [June 16, 2023, 8:54pm UTC](https://forums.swift.org/t/transitive-export-of-inner-type-via-public-typealias-warning/65631 "2023-06-16T20:54:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_J\_Ehrlich](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/david_j_ehrlich/32/3008_2.png) [@David\_J\_Ehrlich](https://forums.swift.org/u/David_J_Ehrlich)\
**Post date:** [June 16, 2023, 8:54pm UTC](https://forums.swift.org/t/transitive-export-of-inner-type-via-public-typealias-warning/65631/1 "2023-06-16T20:54:55Z")

</div>

I have 3 frameworks (I've tested this with 3 SPM library packages, the compiler emits the same warning).

In framework "C", I've defined a struct in a public file:

```swift
public struct StructFromC {
    public struct Inner {
        public init() {}
    }
    public init() {}
}

```

In framework "B", I have a public file containing the following:

```swift
import FrameworkC
public typealias StructFromCViaB = FrameworkC.StructFromC

```

In framework "A", I have a file containing the following:

```swift
import FrameworkB
// No warnings
let structC = StructFromCViaB()
// No warnings
let inner = StructFromCViaB.Inner()
// No warnings
public let publicStructC = StructFromCViaB()
// Warning: Cannot use struct 'Inner' here; 'FrameworkC' was not imported by this file
public let publicInner = StructFromCViaB.Inner()

```

Prior to Xcode 14.3 (or was it Xcode 14.2?), the warning above was not emitted by the compiler. As of Xcode 15, the warning is still emitted. I'm surprised I can declare "public let publicStructC" without a warning, but declaring "public let publicInner" produces a warning.

Is this warning spurious and thus a compiler bug?  
Or was this design flawed and will it eventually fail to compile?

Thanks,  
--David

---

<div class="post-metadata">

**Author:** ![David\_J\_Ehrlich](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/david_j_ehrlich/32/3008_2.png) [@David\_J\_Ehrlich](https://forums.swift.org/u/David_J_Ehrlich)\
**Post date:** [June 19, 2023, 12:14pm UTC](https://forums.swift.org/t/transitive-export-of-inner-type-via-public-typealias-warning/65631/2 "2023-06-19T12:14:26Z")

</div>

I've attached sample projects to Feedback: FB12389427

---

<div class="post-metadata">

**Author:** ![tshortli](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/tshortli/32/15850_2.png) [@tshortli](https://forums.swift.org/u/tshortli)\
**Post date:** [August 3, 2023, 6:53am UTC](https://forums.swift.org/t/transitive-export-of-inner-type-via-public-typealias-warning/65631/3 "2023-08-03T06:53:32Z")

</div>

Do the libraries have library evolution enabled? This diagnostic was [implemented](https://github.com/apple/swift/pull/60317) to prevent the compiler from emitting unparseable `.swiftinterfaces`. When the compiler prints a module interface, it may desugar any reference to a typealias. If the typealias references an original type that is declared in another library, then the desugared type can't be referenced directly unless the module that defines it is explicitly imported. So the diagnostic encourages you to ensure that your module publicly imports the necessary modules.

---

<div class="post-metadata">

**Author:** ![David\_J\_Ehrlich](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/david_j_ehrlich/32/3008_2.png) [@David\_J\_Ehrlich](https://forums.swift.org/u/David_J_Ehrlich)\
**Post date:** [August 3, 2023, 1:48pm UTC](https://forums.swift.org/t/transitive-export-of-inner-type-via-public-typealias-warning/65631/4 "2023-08-03T13:48:41Z")

</div>

This is very helpful.

No, library evolution is not enabled. The application is highly modularized (~46 frameworks plus the main app), however, it is built as a monolith.
