我正在使用“core-js/feature/map”中的地图。通过在地图上调用 has 我得到如下错误:
错误:org.mozilla.javascript.EcmaError:TypeError:类型对象的预期参数,但有类型对象
错误在第 16 行 (if (this.playerStateMap.has(user)) {) 中抛出
var RoulettePlayerManager = /** @class */ (function () {
function RoulettePlayerManager(gameManager) {
this.gameManager = gameManager;
this.playerStateMap = new Map();
}
RoulettePlayerManager.prototype.placeBet = function (user, data) {
var buyIn = data;
var betSum = buyIn.betAmountPurple + buyIn.betAmountGreen + buyIn.betAmountBlue + buyIn.betAmountYellow;
if (1 <= betSum &&
betSum <=
user
.getKnuddelAccount()
.getKnuddelAmount()
.asNumber()) {
user.getKnuddelAccount().use(KnuddelAmount.fromKnuddel(betSum), BET_TEXT);
if (this.playerStateMap.has(user)) {
this.playerStateMap.set(user, new PlayerState_1.PlayerState(user, this.gameManager, data));
}
else {
this.playerStateMap.get(user).updateBet(data);
}
}
};
return RoulettePlayerManager;
}());
该代码在一个java应用程序rhino引擎中运行。
我试图导入完整的 core-js 库,但它没有改变任何东西。