Fourth challenge is First of Array
We can use it for both arrays and tuples, but for tuples you get exact value.
To distinguish arrays and tuples, please visit Making object out of tuple
Previously we described how to iterate over tuples. For this challenge we don’t need it as we can access index directly using
But don’t forget about Generic Constrains using
extends (it’s already added). Without it we cannot call
T and will get an error
Type '0' cannot be used to index type 'T'
Thank you for your time! 🕒
If you interested in test cases, please have a look at Playgroundtypescripteasy