title: Receiving Promise<Void> instead of NSMutableURLRequest
body: <p>I'm attempting to login to my app, however, all my APIRequests are showing as Void instead of APIRequest. This function was working back in Swift 2 and has since gone through some minor changes to attempt to migrate from PromiseKit 4 to PromiseKit 6. </p>
  
  <p>The function does touch a lot of other things, please leave a comment if you need to see more. The function giving me the errors is:</p>
  
  <pre><code>class func recover403(error: Error) -&gt; Promise&lt;NSData&gt; {
          if case let APIError.InvalidToken(request) = error {
              // Log in, then continue the promise chain
              let login = RootViewController.sharedInstance.showLoginController()
              return login.then { request -&gt; Promise&lt;NSData&gt; in
                  return API.transmit(request: request as! APIRequest)
              }
          } else if case CocoaError.userActivityConnectionUnavailable = error {
  
              let vc = ErrorViewController(nibName: "ErrorViewController", bundle: nil)
              let actions = ["Try Again"]
  
              vc.actions = actions
              vc.promise.then { index -&gt; Promise&lt;NSData&gt; in
                  RootViewController.sharedInstance.popAlertViewController()
                  return API.transmit(request: request as! APIRequest)
              }.catch({ (Error) in
                  // No catch
              })
  
              RootViewController.sharedInstance.pushAlertViewController(nvc: vc)
              vc.errorLabel.text = "Please check your network connection and try again!"
          }
          return Promise&lt;NSData&gt;(error: error)
      }
  </code></pre>
  
  <p>'return API.transmit(request: request as! APIRequest)' is throwing</p>
  
  <pre><code>Error: Value of tuple type 'Void' has no member 'value'
  Warning: Cast from 'Void' to unrelated type 'APIRequest' always fails
  </code></pre>
  
  <p>the 2nd 'return API.transmit(request: request as! APIRequest)' is throwing</p>
  
  <pre><code>Error: Generic parameter 'T' could not be inferred
  Warning: Cast from '(String, Any?) -&gt; Promise&lt;_&gt;' to unrelated type 'APIRequest' always fails
  </code></pre>
  
  <p>Here is the APIRequest.swift</p>
  
  <pre><code>import Foundation
  
  class APIRequest: NSMutableURLRequest {
  
      var errorConditions: [APIRequestErrorCondition] = []
  
      init(_ path: String, JSON: Any? = nil) {
          let URL = NSURL(string: API.baseURL + path)!
          super.init(url: URL as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 60)
  
          // Settings for both GET and POST
          setValue(API.agent, forHTTPHeaderField: "User-Agent")
          setValue("application/json", forHTTPHeaderField: "Accept")
  
          // Settings for POST, which is assumed when JSON != nil
          if let JSON = JSON {
              httpMethod = "POST"
              httpBody = try! JSONSerialization.data(withJSONObject: JSON, options: [])
              setValue("application/json", forHTTPHeaderField: "Content-Type")
          }
      }
  
      required init?(coder aDecoder: NSCoder) {
          fatalError("init(coder:) has not been implemented")
      }
  
  }
  </code></pre>
  
  <p>And finally the transmit function:</p>
  
  <pre><code>class func transmit(request: APIRequest) -&gt; Promise&lt;NSData&gt; {
      request.auth()
      return Promise&lt;NSData&gt; { seal in
          let task = URLSession.shared.dataTask(with: request as URLRequest, completionHandler: { (_data, _response, _error) in
              if let data = _data {
                  seal.fulfill(data as NSData)
              } else if let error = _error {
                  if case URLError.badServerResponse = error, let rsp = _response as? HTTPURLResponse {
                      seal.reject(BadUrlError.badResponse(rsp.statusCode))
                  } else {
                      seal.reject(error)
                  }
              } else {
                  seal.reject(PMKError.invalidCallingConvention)
              }
              seal.fulfill(_data! as NSData)
          })
          task.resume()
      }
  }
  </code></pre>
  
  <p>This error touches a lot, so let me know in the comments if there's a section missing that you need to see!</p>
  
  <p>Added: 'request' declaration</p>
  
  <pre><code>class func request&lt;T&gt;(path: String, JSON: Any? = nil) -&gt; Promise&lt;T&gt; {
      let request = APIRequest(path, JSON: JSON)
      request.errorConditions = [API.InvalidTokenCondition, API.BadResponseCodeCondition]
      return API.promise(request: request)
  }
  </code></pre>
  
  <p>Added: 'login' declaration</p>
  
  <pre><code>func showLoginController() -&gt; Promise&lt;Void&gt; {
      if let vc = modalController.vcs.last as? LoginViewController {
          return vc.promise
      }
      let vc = LoginViewController(nibName: "LoginViewController", bundle: nil)
      pushModalViewController(nvc: vc, animated: true)
      return vc.promise
  }
  </code></pre>