DEV Community

loading...

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

Collapse
safarishi profile image
石发磊

type Tt = ((...args: T) => any) extends ((f: any, ...rest: infer R) => any) ? T[R['length']] : never

type Res2 = Tt<['x', 'y']>