Thanks to @Daraan, I was able to figure out how to do this by wrapping TypeVarTuple
inside a Tuple
:
from typing import TypeVar, Callable, Tuple
from typing_extensions import TypeVarTuple
T = TypeVar('T')
Ts = TypeVarTuple('Ts')
def apply(fn: Callable[[*Ts], T], vals: Tuple[*Ts]) -> T:
return fn(*vals)