Closed ackvf closed 4 years ago
I took your Tail function and created a simpler Last implementation. https://github.com/pirix-gh/medium/blob/294725cd723b1a66cfb8b441c862a0d2d5bd184d/types-curry-ramda/src/index.ts#L177-L180
Tail
Last
type Last<T extends any[]> = ((...t: T) => any) extends ((_: any, ...rest: infer TT) => any) ? T[TT['length']] : never type T1 = [10, 20, 30] type T3 = Last<T1> // 30
https://github.com/pirix-gh/medium/blob/294725cd723b1a66cfb8b441c862a0d2d5bd184d/types-curry-ramda/src/index.ts#L408-L415
Thanks bunch for the article, I index in it quite often.
Hi thanks @ackvf, I took your advice long time ago and integrated the changes here.
So I'll just keep this article as is (since it's for learning purposes mostly).
Cheers,
I took your
Tail
function and created a simplerLast
implementation. https://github.com/pirix-gh/medium/blob/294725cd723b1a66cfb8b441c862a0d2d5bd184d/types-curry-ramda/src/index.ts#L177-L180https://github.com/pirix-gh/medium/blob/294725cd723b1a66cfb8b441c862a0d2d5bd184d/types-curry-ramda/src/index.ts#L408-L415
Thanks bunch for the article, I index in it quite often.