Hi All,

I'm new to this list so forgive me if this has been previously discussed.

Is there any work currently towards allowing mapping dependent types of variadic generic TypeVarTuples? For instance, consider this function:

def pair_with_ids(*args):
    return tuple((id(x), x) for x in args)

The single-arg version of this function I could type as:

T = TypeVar('T')

def pair_with_ids(x: T) -> tuple[tuple[int, T]]:
    return ((id(x), x),)

Something similar could be done for any fixed number of parameters, e.g.

T1 = TypeVar('T1')
T2 = TypeVar('T2')

def pair_with_ids(x1: T2, x2: T2) -> tuple[tuple[int, T1], tuple[int, T2]]:
    return ((id(x1), x1), (id(x2), x2))

I would like to be able to type the whole thing at once with something like:

Ts = TypeVarTuple('Ts')
def pair_with_ids(*args: *Ts) -> tuple[*tuple[int, Ts]]:
    return tuple((id(x), x) for x in args)

I realize this breaks the "TypeVarTuple is always starred" rule, but I'm wondering if any kind of dynamic type mapping like this has been considered before.

The idea here being that you always need a star applying to a TypeVarTuple but not necessarily _immediately_ before. The star could be applied to any generic that has a single free type variable filled by a TypeVarTuple.