DEV Community

loading...

Discussion on: How 2 TypeScript: Get the last item type from a tuple of types

Collapse
menocomp profile image
Mina Luke

Interesting I like the way you removed the first item from the tuple.
It can be simplified more by doing this:

type DropFirstInTuple<T extends any[]> = T extends [arg: any, ...rest: infer U] ? U : T;
Enter fullscreen mode Exit fullscreen mode