DEV Community

Discussion on: Advanced TypeScript Exercises - Question 1

Collapse
 
mateiadrielrafael profile image
Matei Adriel • Edited

Nice little challenge, I wouldnt call it advanced tho, maybe more like intermediate?

Edit: heres another challenge: make a type Reverse which takes a tuple of any length and reverses its elements! (Hint: use the { 0: A; 1: B }[C extends D ? 0 : 1] hack to be able to use recursion in some cases where typescript woule've thrown an error)

Collapse
 
macsikora profile image
Pragmatic Maciej

You are really picky :). I hope in the series I will put some questions which will satisfy you. Thanks for feedback.

Collapse
 
mateiadrielrafael profile image
Matei Adriel

Np, check the edit to the original comment to see a challenge idea

Thread Thread
 
macsikora profile image
Pragmatic Maciej

Nice one. Thank you!

Collapse
 
avfirsov profile image
Andrew Firsov

Nice challenge :) Here are 2 solutions