That's not a direct comparison.
Given
struct S: Hashable { }
…
S() as AnyObject // Compiles S() as AnyHashable // Compiles
import typealias Foundation.NSObject S() as NSObject // Cannot convert value of type 'S' to type 'NSObject' in coercion S() as AnyHashable as NSObject // Compiles