Check out example codes for "typescript switch test per case". It will help you in understanding the concepts better.

Code Example 1

switch(true) { 
   case if(constant1 == 1): { 
      //statements; 
      break; 
   } 
   case if(constant2 == 2): { 
      //statements; 
      break; 
   } 
   default: { 
      //statements; 
      break; 
   } 
}

Learn ReactJs, React Native from akashmittal.com