Array.map() produces '[T]', not the expected contextual result type '[String: Any?]' : <p>I'm writing an extension to bridge the dictionary values between FirebaseDatabase and <a href="https://github.com/xmartlabs/Eureka" rel="noreferrer">Eureka</a>.</p>

<pre><code>private extension Dictionary {
    func firebaseFriendlyDictionary() -&gt; [String: Any?] {
        return self.map({ (key: String, value: Any?) -&gt; (String, Any?) in
            if value is NSDate {
                return (key, (value as! NSDate).timeIntervalSince1970)
            }
            return (key, value)
        })
    }
}
</code></pre>

<p>But I get thrown this error when I try to build:</p>

<p><code>map produces '[T]', not the expected contextual result type '[String: Any?]'</code></p>
