TypeScript Professional — Hard
Key points
- Conditional types are used to check if T extends a tuple with a head element and infer the rest.
- The recursion continues until the tuple is fully consumed, returning the length as a numeric literal type.
- Acc['length'] is not used to track the length of the tuple.
Ready to go further?
Related questions
