from typing import List


def to_indexes(input_range: str) -> List[int]:
    """
    Takes a string representing some indexes and returns a list of integers containing the indexes.
    >>>
    >>> to_indexes('2, 5-8, 21')
    [2, 5, 6, 7, 8, 21]
    >>>

    :param input_range: str
    :return: List[int]: A list containing the numbers in the range.
    """
    input_range = input_range.replace(' ', '')
    if not set(input_range).issubset(set('1234567890,-')):
        raise SyntaxError(f"The following characters are not allowed: {set(input_range) - set('1234567890,-')}\n"
                          f"Only use numbers(0-9), comma(,) or dash(-)!")
    result = []
    for part in input_range.split(','):
        if '-' in part:
            a, b = part.split('-')
            result.extend(range(int(a), int(b) + 1))
        else:
            result.append(int(part))
    return result