Аргумент типа 'any' не может быть назначен параметру типа 'never' - PullRequest
0 голосов
/ 01 октября 2018

получил эту ошибку ниже, error TS2345: Argument of type 'any' is not assignable to parameter of type 'never'.

HandEvaluator.prototype.evaluateStraight = function (hand) {
    var consecutives = [];
    var length = hand.ranks.length;
    // for A2345 we put the A already in the consecutive array
    if (hand.hasRank(Rank.ACE))
        consecutives.push(hand.ranks[Rank.ACE][0]);  **<=// LINE 173**
    // we loop through each rank in hand, if we find a group of card
    // we push the first one of the group into consecutives
    // if there is no card at said rank we reset consecutives.
    for (var i = 0; i < length; i++) {
        // we are only sure there is at least one card at that rank
        if (hand.hasRank(i))
            consecutives.push(hand.ranks[i][0]);  <=// LINE 180
        else
            consecutives = [];
        // if we have 5 consecutives cards we still need to check
        // that there isn't anymore after
        if (consecutives.length >= 5) {
            var nextCards = hand.ranks[i + 1];
            if (nextCards && nextCards.length === 0) {
                break;
            }
        }
    }

Я получаю эту ошибку для обеих строк 173 и 180

Любое направление для ошибок типа TypeScript?

...