Generic type 'Result' specialized with too few type parameters (got 1, but expected 2)

You can qualify the reference to Result in order to choose the one you want. The version with one parameter belongs to Alamofire. The one with two parameters belongs to Swift.

typealias Response<T> = (_ result: Alamofire.Result<T>) -> Void

... or ...

static func upload(
    data: Data,
    completion: @escaping (Swift.Result<Int, Error>) -> Void
)

In Alamofire 5.1.0 changing :

typealias Response<T> = (_ result: Result<T>) -> Void

to

typealias Response<T> = (_ result: AFResult<T>) -> Void

worked.

Tags:

Swift5