type a = [1,2,3]
type Invert<T extends any[] & {'0': any}> = ???
type b = Invert<a> // should yield [3,2,1]
I am stucked to figure out the definition of Invert
type of a tuple,
also an Init
and Last
type, although they may be constructed of each others
what I have tried:
- position the type in a function param definition and infer the
Rest
part, this approach only got theTail
part with rest params