Búsqueda de sitios web

typescript - El argumento de tipo 'any' no se puede asignar al parámetro de tipo 'never'


obtuve este error a continuación,
error TS2345: El argumento de tipo 'any' no se puede asignar al parámetro de tipo '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;
            }
        }
    }

Recibo este error tanto en las líneas 173 como 180

¿Alguna orientación sobre errores de 'type' en TypeScript?

Artículos relacionados