TypeScript Professional — Hard
Key points
- The conditional type `T extends Array ? U : T` checks if `T` is an array.
- If `T` is an array, it returns `U`.
- If `T` is not an array, it returns `T`.
- In this case, `T` is not an array, so the output is `string`.
Ready to go further?
Related questions
