Cannot convert value of type '(_) -> Observable<Response>' to expected argument type '([_]) -> _'
<p>I ran into the following error:</p>

<pre><code>Cannot convert value of type '(_) -&gt; Observable&lt;Response&gt;' 
to expected argument type '([_]) -&gt; _'
</code></pre>

<p>when I tried to compile: </p>

<pre><code>func request(_ token: MyAPI) -&gt; Observable&lt;Moya.Response&gt; {
    switch (target.requiresCSRF, target.requiresOAuth) {
    case (false, false): return actualRequest 
    case (true, false): return CSRFTokenRequest().flatMap { _ in actualRequest }
    case (false, true): return OAuthTokenRequest().flatMap { _ in actualRequest }
    case (true, true): return Observable.zip([CSRFTokenRequest(), OAuthTokenRequest()]) { _ in actualRequest }
    } 
}
</code></pre>

<p>actualRequest is of type <code>Observable&lt;Response&gt;</code>
both CSRFTokenRequest and OAuthTokenRequest is of type <code>Observable&lt;String?&gt;</code></p>

<p>I'm trying to run <strong>CSRFTokenRequest</strong> before <strong>OAuthTokenRequest</strong> and then the actual request.</p>

<p>The following resolves the issue... but I'm not sure if this is the right way to do it...</p>

<pre><code>return RequiresCSRFTokenRequest().flatMap{ _ in
            self.RequiresAuthenticationRequest().flatMap{ _ in actualRequest}
        }



fileprivate extension Networking{

    func RequiresAuthenticationRequest() -&gt; Observable&lt;String&gt; {

        /// This has 3 cases

        // 0. token is not present, error out
        // 1. token is not expired, return token
        // 2. token is expired, needs refresh

        guard let jwt = AuthManager.shared.accessToken else{
            return .just("Error!! No access tokens")
        }

        // If access token is valid
        if AuthManager.shared.expiredAccessToken == false{

            return .just(jwt)

        }else{

            return request(.refreshAccessToken(refreshToken: AuthManager.shared.refreshTokenWithBearer!))
                .filterSuccessfulStatusCodes()
                .mapObject(type: UserAuthenticationTokens.self)
                .do(onNext: {
                    $0.save()})
                .map{ (token) -&gt; String in
                    // Get new access token that was just saved
                    return AuthManager.shared.accessToken!
            }
        }

    }


    func RequiresCSRFTokenRequest() -&gt; Observable&lt;String&gt; {

        // Always get a new csrf token
        return request(.getCSRF())
            .filterSuccessfulStatusCodes()
            .mapObject(type: CSRFToken.self)
            .do(onNext: {
                $0.save()
            }).map{ (token) -&gt; String in
                return AuthManager.shared.csrf_token!
            }
    }

}
</code></pre>

<p>Thanks! </p>