如果没有上下文类型,则无法解析对成员 'value' 的 PromiseKit 6 引用

PromiseKit 6 Reference to member 'value' cannot be resolved without a contextual type

从 PromiseKit 4 到 6 的更新是这个...

Promise(foo)

变成了...

.value(foo)

除了我的 ContestListViewController.swift..

中的一个实例外,这在我更新项目的整个过程中都对我有用
func confirmEntry(to contest: Contest, with lineup: Lineup) -> Promise<Lineup> {
    let entryConfirmationVC = EntryConfirmationViewController()
    entryConfirmationVC.configure(for: contest, lineup: lineup)
    return entryConfirmationVC.promise().then { seal in return .value(lineup) }
}

这给我一个错误,内容是...

Reference to member 'value' cannot be resolved without a contextual type

这里是EntryConfirmationViewController.swift

的相关信息
class EntryConfirmationViewController: DraftboardModalViewController {

    // 9 variable declarations
    // Removed code for readability

    let (pendingPromise, seal) = Promise<Void>.pending()

    // override func loadView()
    // Removed code for readability

    func promise() -> Promise<Void> {
        let defaults = UserDefaults.standard
        if defaults.bool(forKey: App.DefaultsDontAskToConfirmEntry) {
            seal.fulfill(())
            return pendingPromise
        }

        RootViewController.sharedInstance.pushModalViewController(nvc: self)
        return pendingPromise
    }

    func configure(for contest: Contest, lineup: Lineup) {
        confirmationLabel.text = contest.name.uppercased()
        prizeStatView.valueLabel.text = Format.currency.string(from: NSNumber(value: contest.prizePool))
        entrantsStatView.valueLabel.text = "\(contest.currentEntries)"
        feeStatView.valueLabel.text = Format.currency.string(from: NSNumber(value: contest.buyin))
        enterButton.setTitle("Enter “\(lineup.name)”".uppercased(), for: .normal)
    }

    // @objc func tappedEnterButton()
    // Removed code for readability

    // @objc func tappedCancelButton() 
    // Removed code for readability
}

如何让我的 ContestListViewContoller.swift 中的 confirmEntry 像其余的 .value(foo) 调用一样工作?

您需要告诉 compiler 您从 then 块返回的内容,

.then { seal-> Promise<Lineup> in return .value(lineup) }