InterviewSolution
Saved Bookmarks
| 1. |
What are conditional types? How do you create them? |
|
Answer» A conditional type ALLOWS you to DYNAMICALLY select one of two POSSIBLE types based on a CONDITION. The condition is expressed as a type relationship test. C extends B ? TypeX : TypeYHere, if type C extends B, the value of the above type is TypeX. Otherwise, it is TypeY. |
|